MultiFile: Unable to "add" files over 2GB

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

MultiFile: Unable to "add" files over 2GB

Guest-1003
Reply | Threaded
Open this post in threaded view
|

Re: MultiFile: Unable to "add" files over 2GB

Guest-1003
The single file upload works fine.  When i use the multifile, i'm able to add files under 2GB to the upload list.  When i select a larger file from the browser, it doesn't appear in the file list.
Reply | Threaded
Open this post in threaded view
|

Re: MultiFile: Unable to "add" files over 2GB

Dean Brettle
Administrator
NeatUpload does not impose the 2GB limit.  Instead, Flash and most browsers are not capable of uploading files larger than 2GB.  Also, most servers (e.g. IIS) are not capable of receiving files larger than 2GB.  To workaround these limitations you need to use a different web server and something else on the client side (e.g. a Java applet or ActiveX control).  To integrate the client side with NeatUpload, see Uploading from a Client Application.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: MultiFile: Unable to "add" files over 2GB

Guest-1003
Even as files are being added to the list?  This is before any post-back (while files are being added). 
Reply | Threaded
Open this post in threaded view
|

Re: MultiFile: Unable to "add" files over 2GB

Dean Brettle
Administrator
Sorry, I'd assumed that Flash just refused to allow files larger than 2GB to be selected.  However, after looking into this some more, it seems I was wrong.  NeatUpload uses a modified version of SWFUpload under the covers and tells SWFUpload not to allow files larger than 2GB.  If you select a file larger than 2GB, the SWFUpload code actually generates an error, but NeatUpload ignores that error.  To get notified of the error without modifying NeatUpload, you'd need to add something like this after your <body> element:

    <script type="text/javascript">
    var mf = NeatUploadMultiFile.prototype.Controls["yourControlID"];
    var intervalID = window.setInterval(function () {
        if (!mf.Swfu) return;
        window.clearInterval(intervalID);
        mf.Swfu.error = function(errCode, file) {
            window.alert("Errcode = " + errCode);
            if (errCode == SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT)
                window.alert(file.size + " is too large.");
        };
    }, 100);
    </script>

That is admittedly awkward.  The whole setInterval() thing is necessary to poll for the SWFUpload object, which is created asynchronously.

The 2GB limit that NeatUpload passes to SWFUpload is hardcoded in NeatUpload.js (search for file_size_limit), but you really don't want to increase that.  I just tried and although I could select larger files, uploading them caused silent failure presumably due to the Flash and server limitations I mention in my first post.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: MultiFile: Unable to "add" files over 2GB

Guest-1003
Thanks much.
Reply | Threaded
Open this post in threaded view
|

Re: MultiFile: Unable to "add" files over 2GB

Dean Brettle
Administrator
On second thought, a much simpler solution is to just override SWFUpload.prototype.error, like this:

SWFUpload.prototype.error = function(errCode, file, msg) {
            if (errCode == SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT)
                window.alert(file.size + " is too large.");
            else
                this.debugMessage("Error Code: " + errCode + ", File name: " + file.name + ", Message: " + msg);
};

That would apply to all MultiFile controls on the page (which is probably what you want anyway), and would avoid the whole setInterval() mess.

--Dean