2

I want to upload a file size of 1 GB with ASP.NET . I Write This Code

 Dim bytes(up_FileImage.UploadedFiles(0).ContentLength) As Byte
                    bytes = File.ReadAllBytes(Path.Combine(Request.PhysicalApplicationPath, "App_Data/", ViewState("DirectoreName").ToString(), up_FileImage.UploadedFiles(0).FileName))
                    itemDocFile.FileImage = bytes

and in web.config Write this Code

<httpRuntime maxRequestLength="102400" executionTimeout="3600"/>

but in First Line I Get this Error

system.out of memory exception

Please Help Me. Thanks All

Pouya
  • 1,908
  • 17
  • 56
  • 78
  • default size of IIS is only 4MB, so it will give you error for uploading 1GB size file, try to set the size of file from your webconfig file. – Krunal Patil May 14 '14 at 09:02
  • @ Krunal Patil: I Update Question. Thanks. – Pouya May 14 '14 at 09:23
  • File.ReadAllBytes() means you will load into memory everything. try to avoid this if you can. – rdmptn May 20 '14 at 16:27
  • possible duplicate of [How to upload up 10gb file on ASP.NET](http://stackoverflow.com/questions/17904580/how-to-upload-up-10gb-file-on-asp-net) – CRABOLO Jun 23 '14 at 03:17

1 Answers1

0

Uploading a file that large is unadvisable. Here's some alternatives: https://stackoverflow.com/a/17904718/902874

Community
  • 1
  • 1
InbetweenWeekends
  • 1,405
  • 3
  • 23
  • 28