KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to write a file upload script that works in IE but the two types of code that I'm writing have problems in IE. Please help. How can you write a file upload script that works in IE? Type 1 Problem Not Support File Api In IE (Is the trick not to use it?) <!DOCTYPE html> <html> <head runat="server"> <title></title> <script src="Scripts/jquery-1.6.2.js" type="text/javascript"></script> <script type="text/javascript"> function updateSize() { var nBytes = 0; var nFiles=0; oFiles = document.getElementById("uploadInput").files; nFiles = oFiles.length; for (var nFileId = 0; nFileId < nFiles; nFileId++) { nBytes += oFiles[nFileId].size; } var sOutput = nBytes + " bytes"; // optional code for multiples approximation for (var aMultiples = ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"], nMultiple = 0, nApprox = nBytes / 1024; nApprox > 1; nApprox /= 1024, nMultiple++) { sOutput = nApprox.toFixed(3) + " " + aMultiples[nMultiple] + " (" + nBytes + " bytes)"; } document.getElementById("fileNum").innerHTML = nFiles; document.getElementById("fileSize").innerHTML = sOutput; } // end of optional code </script> </head> <body> <form id="form1" runat="server"> <p><input id="uploadInput" type="file" name="myFiles" onchange="updateSize();" multiple /> selected files: <span id="fileNum">0</span>; total size: <span id="fileSize">0</span></p> <p><input type="submit" value="Send file"></p> </form> </body> </html> Type 2 Problem Not Support document.getElementById('fileToUpload') .files[0]</strong
Tags (comma-separated)
Save Edits
Cancel