Upload large files to s3 with ASP.net MVC?

From the sound of it, you have 3 systems involved in this. There is a client running a web-browser, there is your server, and there is S3. As I understand your scenario, the client makes a request against your server, causing your server to upload a file to S3.

You mention that the browser is complaining that the server is not responding. That is probably because your server is busy uploading the file to S3. While your server is uploading the object to S3, it is not sending any status updates to the browser.

If the upload takes long enough, the browser will give up waiting. That doesn't mean that the upload didn't happen, just that the browser stopped waiting for your server to respond. What you need to do is return some kind of incremental result to the client.

I'm not a . Net programmer, but what I would probably do is to spawn an new thread to do the upload, and on the request thread return some initial content indicating that the request was underway, flush that response but not close the output. When have a loop that waited for the upload thread, waking up every 5 seconds to writing a space character and flushing that to the client.

That will keep the browser from timing-out.

That's right, and thanks for the feedback. The client to Rackspace Cloud site works ok, but then the time involved to offload to S3 from Rackspace causes the browser issue. Chrome only allows around 30 seconds for this transfer before the time out.

I'm currently uploading files to the host ok, saving to the file system and db and attempting to run some sort of background thread to transfer to S3. This is working for small files, but still having issue on large (30 - 50mb) files. I would have thought this was a common task, and there would be a few samples out there in .

Net land. – Adrian Feb 2 at 4:19.

As I understand your scenario, the client makes a request against your server, causing your server to upload a file to S3. You mention that the browser is complaining that the server is not responding. That is probably because your server is busy uploading the file to S3.

While your server is uploading the object to S3, it is not sending any status updates to the browser. If the upload takes long enough, the browser will give up waiting. That doesn't mean that the upload didn't happen, just that the browser stopped waiting for your server to respond.

What you need to do is return some kind of incremental result to the client. I'm not a . Net programmer, but what I would probably do is to spawn an new thread to do the upload, and on the request thread return some initial content indicating that the request was underway, flush that response but not close the output.

When have a loop that waited for the upload thread, waking up every 5 seconds to writing a space character and flushing that to the client. That will keep the browser from timing-out.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions