General discussion

Locked

Web Services TechMail Forum

By Mark W. Kaelin Editor ·
Create a file upload Web service:

A recent Web Services TechMail discusses file management systems. Have you developed a Web service for handling file system management in your applications?

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

How to upload larger files

by Mark W. Kaelin Editor In reply to Web Services TechMail For ...

A reader asked via e-mail:

In our web solution we have a page were it is possible to upload files. We have a major problem with this.

By default there is not possible to upload larger files than 4096kb to the site. If you try an error will be generated. In web.config there is a setting:



<httpRuntime maxRequestLength="4096"/>



This setting can be increased to allow bigger files to be uploaded. But this is not good enough. If you ever reach the max limit it will always generate an error. The funny thing is that you will not be able to handle this error. I find no way to handle it anyway.

Kevin's response:
In our web solution we have a page were it is possible to upload files. We have a major problem with this.

By default there is not possible to upload larger files than 4096kb to the site. If you try an error will be generated. In web.config there is a setting:



<httpRuntime maxRequestLength="4096"/>



This setting can be increased to allow bigger files to be uploaded. But this is not good enough. If you ever reach the max limit it will always generate an error. The funny thing is that you will not be able to handle this error. I find no way to handle it anyway.

Collapse -

How to upload a large file

by Mark W. Kaelin Editor In reply to Web Services TechMail For ...

A reader asked via e-mail:

In our web solution we have a page were it is possible to upload files. We have a major problem with this.

By default there is not possible to upload larger files than 4096kb to the site. If you try an error will be generated. In web.config there is a setting:



<httpRuntime maxRequestLength="4096"/>



This setting can be increased to allow bigger files to be uploaded. But this is not good enough. If you ever reach the max limit it will always generate an error. The funny thing is that you will not be able to handle this error. I find no way to handle it anyway.

Author Kevin Koch's response:

If your Web service implements a maximum file upload size as a business rule, the client application would need to be aware of this. Once the file is extracted from the request and you read the length of that file into the file length variable, just run a simple If check to see if the size exceeds the max length handled by the Web service. You could also implement this check on the server but this would result in redundant hits to your application.



Once you have determined that the length is valid you may invoke an asynchronous method which uploads the file in chunks of X number of bytes at a time, or invoke the Web service itself asynchronously and upload the entire file at once. This will allow a transparent upload without locking the client during large uploads.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums