This is a proof of concept for mobile webapp file upload.
http://emy-library.org/sandbox/fileupload/
Its using Emy but might just fit in iUI easily too (tweaking here and
there) since it's plain Javascript.
Feel free to fork :)
This will never be a core feature for Emy, since uploading a picture is
really not a common scenario for most web applications.
Remi
Le mercredi 28 août 2013 14:56:20 UTC+2, Remi Grumeau a écrit :
>
> You don't need an iframe for that.
>
> Something similar to this (not tested) should be enough
>
> <input id="fileinput" type="file" name="file" onchange="uploadIt()">
>
> <script>
> function uploadIt() {
>
> var xhr = new XMLHttpRequest();
>
> xhr.upload.addEventListener('progress',function(ev){
> var progress = (ev.loaded/ev.total)*100;
> console.log('Upload progress: '+progress+"%");
> }, false);
>
> xhr.onreadystatechange = function(ev) {
> if (xhr.readyState === 4) {
> if (xhr.status === 200) {
> if(xhr.responseText != 'error')
> {
> console.log('Upload done');
> }
> } else {
> console.log("Upload Error "+ xhr.statusText);
> }
> }
> };
>
> xhr.open('POST', "xhr_upload.php", true);
> var files = document.getElementById('fileinput').files;
> var data = new FormData();
> data.append('file', files[0]);
> xhr.send(data);
> }
> </script>
>
>
> Remi
>
--
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/iphonewebdev.
For more options, visit https://groups.google.com/groups/opt_out.