here i want to point out a code which i found from here Using plupload with MVC3. whose intention is to upload a single file but my requirement is bit different like i need to upload few large file say 3 files and each file size could be 2GB.
[HttpPost]
public ActionResult Upload(int? chunk, string name)
{
var fileUpload = Request.Files[0];
var uploadPath = Server.MapPath("~/App_Data");
chunk = chunk ?? 0;
using (var fs = new FileStream(Path.Combine(uploadPath, name), 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);
}
return Json(new { message = "chunk uploaded", name = name });
}
$('#uploader').pluploadQueue({
runtimes: 'html5,flash',
url: '@Url.Action("Upload")',
max_file_size: '5mb',
chunk_size: '1mb',
unique_names: true,
multiple_queues: false,
preinit: function (uploader) {
uploader.bind('FileUploaded', function (up, file, data) {
// here file will contain interesting properties like
// id, loaded, name, percent, size, status, target_name, ...
// data.response will contain the server response
});
}
});
just wonder anyone can tell me what else i need to add in above server side and client side code which enable me to upload multiple large files. thanks
You might well need to add an entry to your
web.config
file to allow for the large file size (2097152KB = 2GB). The timeout in seconds you can adjust accordingly:also you can set request limit (which is in bytes) to be 2GB,