Topic: Mulitple large files fail to load

Hi I'm new so sorry if this topic has been covered before. Please reference me to the right discussion if it has.

I'm trying to upload multiple .VOB file from a DVD. If I select one file, say 1024MB it uploads fine. If I select two files, say one 1024MB and the other is 500MB, the first one uploads and the second one never uploads.

I'm using .NET and c# Here is my code. Thanks for your help

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
        <style type="text/css">@import url(js/jquery.plupload.queue/css/jquery.plupload.queue.css);</style>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>

        <!-- Third party script for BrowserPlus runtime (Google Gears included in Gears runtime now) -->
        <script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>

        <!-- Load plupload and all it's runtimes and finally the jQuery queue widget -->
        <script type="text/javascript" src="js/plupload.full.js"></script>
        <script type="text/javascript" src="js/jquery.plupload.queue/jquery.plupload.queue.js"></script>

        <script type="text/javascript">
        // Convert divs to queue widgets when the DOM is ready
        $(function() {
            $("#uploader").pluploadQueue({
                // General settings
                runtimes : 'gears,flash,silverlight,browserplus,html5',
                max_file_size : '2000mb',
                chunk_size : '1mb',
                unique_names : false,
                multi_selection: true,

                // Specify what files to browse for
                filters : [
                    {title : "VOB files", extensions : "vob"},
                ],
                
                url: 'upload.ashx',

                // Flash settings
                flash_swf_url : 'js/plupload.flash.swf',

                // Silverlight settings
                silverlight_xap_url : 'js/plupload.silverlight.xap',
            });

            // Client side form validation
            $('form').submit(function(e) {
                var uploader = $('#uploader').pluploadQueue();

                // Files in queue upload them first
                if (uploader.files.length > 0) {
                    // When all files are uploaded submit form
                    uploader.bind('StateChanged', function() {
                        if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
                            $('form')[0].submit();
                        }
                    });
                       
                    uploader.start();
                } else {
                    alert('You must queue at least one file.');
                }

                return false;
            });
        });
        </script>
</head>
<body>
    <form id="form1" runat="server">
        <div id="uploader">
            <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
        </div>
    </form>
</body>
</html>



Code behind


        if (Request.Files.Count > 0)
        {
            int chunk = Request["chunk"] != null ? int.Parse(Request["chunk"]) : 0;
            string fileName = Request["name"] != null ? Request["name"] : string.Empty;

            HttpPostedFile fileUpload = Request.Files[0];

            var uploadPath = Server.MapPath("~/Uploads");
            using (var fs = new FileStream(Path.Combine(uploadPath, fileName), chunk == 0 ? FileMode.Create : FileMode.Append))
            {
                var buffer = new byte[fileUpload.InputStream.Length];
                fileUpload.InputStream.Read(buffer, 0, buffer.Length);

                fs.Write(buffer, 0, buffer.Length);
            }
        }



in my web.config file

<httpRuntime  maxRequestLength="2097151" executionTimeout="7200"/>

Re: Mulitple large files fail to load

invert the files order, try to upload the 500 MB file first and post the results

which runtime is being used?

Re: Mulitple large files fail to load

Yes I tried it both ways and both fail to upload the second file. When you say post the results do you mean free hand like this or is there  a log somewhere I can post?

Re: Mulitple large files fail to load

free hand. if you try to upload smaller files, it will upload without problems?

do you use firebug? if yes, is there any error in it?

Re: Mulitple large files fail to load

I can load 3 500MB files together and it works ok.

I add a 1024MB .VOB file from a DVD and it has trouble.

As you know DVDs are divided up into .VOB files that are maxed out at 1024MB. So if you have a 4GB video you have 4 1024MB VOB files on a DVD.

I think it is using the flash version when I try the upload?

I don't use Firebug. I can try if needed?

Re: Mulitple large files fail to load

ok try firebug as it show if there are errors in flash too. Do you know how to use it?

Re: Mulitple large files fail to load

No I will research it on the web before I take your time you again. Thanks

Re: Mulitple large files fail to load

the documentation on firebug site is very good. I think it will be enough for you.

Re: Mulitple large files fail to load

Update so far Firefox crashes when I use Firebug. Trying to fiddle with it

Re: Mulitple large files fail to load

So when I get firebug to run, I try and load 3 files, 500MB, 1024MB and 1024MB. it stops part way through the first file, 500MB file and I get an "IO error. (Error #2032). I have no clue where to look this error up

Re: Mulitple large files fail to load

Those are very big files, you should consider what runtime you are using and what version of browser you are using.  Some of the runtime/browser combinations will load the entire file into memory before sending and with firebug who knows what the effect would be.

You might find the large file post helpful:
http://www.plupload.com/punbb/viewtopic.php?id=16

less relevant is the large images with flash post:
http://www.plupload.com/punbb/viewtopic.php?id=387

They are both a bit dated and not completely accurate but they should give you good background on the types of problems you run into with large files.

Re: Mulitple large files fail to load

Thank you. I did look at http://www.plupload.com/punbb/viewtopic.php?id=16 and I tried different chunk size between 250kb and 5 MB. Same problem happens with the flash uploader.

On the same server I tried this uploader out http://silverlightfileupld.codeplex.com/ with success. I could live with just using silverlight I guess since flash seems to choke.  I will try and see if I can get the plupload silverlight loader to work

Re: Mulitple large files fail to load

Update, I can get the silverlight version to work with a chunk size of 500kb but not 1024mb

Re: Mulitple large files fail to load

I could be wrong but I think in the latest versions of every browsers except IE and Safari on Windows the html5 runtime with chunking will only load each chunk into memory as it needs them.  Large files in this case should be fine.