Search code examples
javascripthtmluiwebviewhtml5-videobusboy

I am trying to upload Video from "Photos" app using Html 5 form for iOS devices


We are trying to upload Video from "Photos" app using Html 5 form . Every time I record the Video and upload to server, the file is getting uploaded. But if I try to upload the existing video from gallery , the file size gets zero. Here is my code.

HTML code.

<input accept="video/*;capture=camera" type="file" name="files[]" id="fileinput" multiple data-role="none"/>

Javascript code.

$('#fileinput').change(function(e){
e.preventDefault();
var input = document.getElementById('fileinput');
file = input.files[0];
console.log("file size in chat.js is ="+file.size);
if(file.size<=22020096){
var formdata = new FormData(document.getElementById('fileForm'));
formdata.append("user", user);
formdata.append("frndname", frndname);
formdata.append("fileSize", formatBytes(file.size));
formdata.append("fileName", file.name);
}

Please suggest.


Solution

  • Changing the HTML code to below lines, the issue got resolved.

    <input accept=".MOV;capture=camera" type="file" name="files" id="fileinput"/>