Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Large file upload though html form (more than 2 GB)

Is there anyway to upload a file more than 2 GB, using simple html form upload? Previously I have been uploading large files through silverlight using chunking (dividing a large file into segments and then uploading segments one by one & then reassemble segments at server).

Now, we have a requirement that we just have to use simple html (though GWT) form uploads. Please guide me if there is any way to achieve large file upload this way.

If it is impossible to do it using simple html, can anyone guide me about how I can divide & upload a file in segments using flex?

like image 593
Nadeem Ullah Avatar asked Feb 19 '11 20:02

Nadeem Ullah


People also ask

How do I handle large uploads?

Possible solutions: 1) Configure maximum upload file size and memory limits for your server. 2) Upload large files in chunks. 3) Apply resumable file uploads. Chunking is the most commonly used method to avoid errors and increase speed.

How do I upload files larger than 100mb on github?

To upload files larger than 100mb to github, you will need to use github large file storage system (Github LFS). WARNING: You cannot use github LFS with “forked repo”. Git will reject the commit when you try to push it to github. Git LFS has to be done on your own personal repo.


2 Answers

The limitation of the size of HTTP POST requests is usually not in the HTML side at all. The limitation is more in the server side. The webserver needs to be configured to accept that large POST requests. The default is usually indeed often 2GB and the server will usually return a HTTP 500 error on that. The default limit can often be increased to 4GB, but anything beyond that will hit the border on 32bit systems. On 64bit systems with a 64bit OS, the theoretical border is much higher, 16EB.

If configuring the webserver to accept that large POST requests is not an option, or when you want to go beyond the webserver's limit, then you have no other option than splitting the file in the client side and reassembling the parts in the server side.

Since HTML is just a markup language, it offers no facilities for splitting the file. You really have to use a normal programming language like C# (Silverlight) or Java (Applet) in flavor of a small application which you serve by your webpage. Very maybe it's also possible with Flash or Flex, but don't pin me on that since I do neither.

Said that, FTP is a much better choice than HTTP for transferring (large) files over network. I'd reconsider the choice of using HTTP for that.

like image 51
BalusC Avatar answered Sep 21 '22 15:09

BalusC


Use HTML5 File API to upload large files. which has the concept of slicing, so that you can upload large files.

var reader= new FileReader(); reader.onload=function(e){  //do whatever you want with result } var blob = file.slice(startingByte, endindByte);//slicing file reader.readAsBinaryString(blob); 

FileSystem Tutorial

File API tutorial

like image 35
kongaraju Avatar answered Sep 22 '22 15:09

kongaraju