Created
September 8, 2019 17:15
-
-
Save nolanlawson/6fe0456c4b3996e69bbd1c2f11920d76 to your computer and use it in GitHub Desktop.
Test iOS file types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Test iOS audio input</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<h1>Test iOS audio input</h1> | |
<div> | |
<label> | |
Accepts only audio: | |
<input type="file" accept="audio/*"> | |
</label> | |
</div> | |
<div> | |
<label> | |
Accepts both audio and images: | |
<input type="file" accept="audio/*,image/*"> | |
</label> | |
</div> | |
<div> | |
<label> | |
Accepts all file types: | |
<input type="file" accept="*/*"> | |
</label> | |
</div> | |
<pre id="display"></pre> | |
<script> | |
(function () { | |
'use strict' | |
document.querySelectorAll('input').forEach(function (input) { | |
input.addEventListener('change', function (e) { | |
if (e.target.files && e.target.files[0]) { | |
var file = e.target.files[0] | |
document.getElementById('display').innerHTML += "File name: " + file.name + ", size: " + | |
file.size + '\n' | |
} | |
}) | |
}) | |
})() | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment