Jun 01, 2012, 8:13 AM
[CLOSED] multiple file upload and file size at client side
Hi
I am looking to upload multiple files with computing file sizes at client side before submitting to the server. After searching through the forums, I found out that it was not possible due to security reason (at least for filesize) or alternatively use swfupload.
I have a the following whcih works under chrome and firefox, is there a way to extend ext:FileUploadField in a similar way?
I am looking to upload multiple files with computing file sizes at client side before submitting to the server. After searching through the forums, I found out that it was not possible due to security reason (at least for filesize) or alternatively use swfupload.
I have a the following whcih works under chrome and firefox, is there a way to extend ext:FileUploadField in a similar way?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript">
function setUploadSize(el,id1,id2)
{
var size=0;
for(var num1=0;num1<el.files.length;num1++)
{
var file=el.files[num1];
//alert(file.name+" "+file.type+" "+file.size);
size+=file.size;
}
document.querySelector("#"+id1).textContent=el.files.length;
document.querySelector("#"+id2).textContent=Math.round(size/1000);
}
</script>
</head>
<body>
<form>
<input type="file" multiple="multiple" onchange="setUploadSize(this,'count','size')" /><br/>
Total files: <span id="count">0</span>, Total Kb: <span id="size">0</span>
</form>
</body>
</html>
Last edited by Daniil; Dec 21, 2014 at 1:56 PM.
Reason: [CLOSED]