1

I'm looking for possible ways for sending files from browser to server. One obvious way is using form with enctype='multipart/form-data'. I wonder if there are other ways than this.

The reason I ask you this question is this file uploader: http://aspnetajax.componentart.com/control-specific/upload/features/core_features/WebForm1.aspx

It's not flash based, but it sends the file in a way that it gives you a progress bar, but when you send a file with form with enctype='multipart/form-data' the whole file will be send to the server so you can't actually show a progress bar of uploading process.

EBAG
  • 21,625
  • 14
  • 59
  • 93

2 Answers2

1

You can actually get a progress bar for a regular file upload, but as the server only will handle one request at a time for each user, you have to use session-less requests to ask the server for the upload progress.

So, on the server you need to set up a way to identify an upload without using the user session, and a way to communicate the upload status between different threads. That enables you to set up a session-less page that can get the status of a specific upload and return it.

In the upload page you send the request with the upload, then start sending requests for the session-less page on an interval, and display the status of the upload.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • by using enctype='multipart/form-data' I can progressivly receive the file on server? – EBAG Dec 24 '10 at 15:25
  • How would you determine the file size on the client? You'd need the HTML5 APIs for file handling, no? – Pointy Dec 24 '10 at 15:25
  • @Pointy: You don't determine the file size on the client, you do that on the server side, then communicate that back through the session-less page. – Guffa Dec 24 '10 at 15:27
  • Ah - the POST header and/or the MIME stuff has the content size. Ok that makes sense. – Pointy Dec 24 '10 at 15:37
0

Here is a stack overflow question with some helpful links.

Upload large files in .NET

I believe you can write your own http module to achieve the upload with progress. Here is a link to an example

http://darrenjohnstone.net/2008/07/15/aspnet-file-upload-module-version-2-beta-1/

Hope this helps.

Bob

Community
  • 1
  • 1
rcravens
  • 8,320
  • 2
  • 33
  • 26