Uploading a large file (up to 100gb) through ASP.NET application

后端 未结 2 494
鱼传尺愫
鱼传尺愫 2020-12-30 00:22

I need to somehow implement an ability to upload files through an ASP.NET application which is working within our corporate network. The problem is those files are getting i

相关标签:
2条回答
  • 2020-12-30 00:45

    Yes there is, you need to split the file in smaller parts see the example here: http://forums.asp.net/t/1742612.aspx?How+to+upload+a+big+file+in+Mvc+

    0 讨论(0)
  • 2020-12-30 00:46

    You could consider sending it in chunks. This would skip over the large file requirement (as each request would only be the size of the chunk you send), but is slightly more complicated on the client and server side.

    I've done something similar for streaming uploaded files over a websocket, but this could easily be done with multiple ajax requests. In either case you'll want to use the JavaScript File API to read a segment of the file on the client's computer, encode that segment to something you can send (probably Base64), and send that particular segment to the web server. You could also send additional data such as file position to ensure the server is writing the file properly. The server can choose how to respond (can be as simple as a "true" to acknowledge receipt), after which the client javascript would read and send the next chunk of the file.

    I have a demo of this using WebSockets on a github repo here (ASP.NET MVC server-side code here) but with a few tweaks you could easily make this into sequential AJAX requests.

    0 讨论(0)
提交回复
热议问题