Remember a time when jquery file upload's breakpoint continues to pass on the tangled course

Source: Internet
Author: User
Tags ranges jquery file upload

Related reference: http://www.cnblogs.com/ASPNET2008/p/3360427.html

Start to do a breakpoint to continue to copy the string of code directly, put in my project after the filename in the request.files has been "blob",

Then I dragged and dragged for a long time, and then intend to give up, and yesterday test Jquer file upload this upload component when found that more than 2G of file dead can not be passed up!

 1  <system.web>2   2147483647 " Span style= "color: #800000;" > " Executiontimeout="  3600   "/>3  <compilation debug="  true   " Targetframework= " 4.0  " />4  <customerrors mode= off  Span style= "color: #800000;" > "/>5  </system.web> 

Later found that the maximum supported file size after Setup is about 2G, then I re-do the file breakpoint continued! I hope we can handle this problem!

But! Or not get filename!!!!

And then! I changed a way to use the request.headers["X-file-name"], sure enough to get to the filename!

But! There is no content-range value in the SaveAs!

After another tangle, I found that because I used the plug-in version is too low. And then! I went to the official website to download the latest version of the plugin!

Sure enough There's no problem with filename and content-range getting it!

And yet! More than 2G of files exceeding 2G can not be uploaded! And I lost to the blogger! Don't even think about the problem of oversized files!

1 Private voidSaveAs (stringSavefilepath, httppostedfile file)2 {3     LongLstartpos =0;4     intStartPosition =0;5     intEndposition =0;6     varcontentrange=httpcontext.current.request.headers["Content-range"];7     //bytes 10000-19999/11576328     if(!string. IsNullOrEmpty (contentrange))9     {TenContentrange = Contentrange.replace ("bytes",""). Trim (); OneContentrange = contentrange.substring (0, Contentrange.indexof ("/")); A         string[] ranges = Contentrange.split ('-'); -StartPosition =int. Parse (ranges[0]); -Endposition =int. Parse (ranges[1]); the     } - System.IO.FileStream FS; -     if(System.IO.File.Exists (savefilepath)) -     { +FS =System.IO.File.OpenWrite (savefilepath); -Lstartpos =FS. Length; +           A     } at     Else -     { -FS =NewSystem.IO.FileStream (Savefilepath, System.IO.FileMode.Create); -Lstartpos =0; -     } -     if(Lstartpos >endposition) in     { - FS. Close (); to         return; +     } -     Else if(Lstartpos <startposition) the     { *Lstartpos =startposition; $     }Panax Notoginseng     Else if(Lstartpos > StartPosition && lstartpos <endposition) -     { theLstartpos =startposition; +     } A FS. Seek (Lstartpos, System.IO.SeekOrigin.Current); the     byte[] Nbytes =New byte[ +]; +     intNreadsize =0; -nreadsize = file. Inputstream.read (Nbytes,0, +); $      while(Nreadsize >0) $     { -Fs. Write (Nbytes,0, nreadsize); -nreadsize = file. Inputstream.read (Nbytes,0, +); the     } - FS.          Close (); Wuyi}

Note 13 lines! 14 Lines! The file byte exceeds 2G when int is out of range!

is to set the variable to a Long data type!

Finally, one months have passed.

I got it. haha!!!!!

Remember a time when jquery file upload's breakpoint continues to pass on the tangled course

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.