Archived Forum Post

Index of archived forum posts


Debugging HTTP Uploads

Jun 29 '12 at 10:38

Suddenly the component is no longer uploading files on the server.

I used the code in the example of your web site ( and I get this result:

Num file received: 0 Success.

As you can see, I get the success flag but no file is uploaded onto the server.

Any idea why or what can cause that ? What can I do to avoid this problem? Is there another way to proceed?


HTTP uploads can be a bit confusing to debug, because both client-side and server-side must be functioning correctly. Usually one doesn't know if the problem exists within the server-side code, or the client-side code. One way to test is to swap out the client-side with something that will for-sure send the upload correctly. For example, use a simple HTML page for testing the server-side code receiving code. Using the HTML shown below, the browser (IE or Firefox for example) sends the upload.

<form method="POST" enctype="multipart/form-data" action = "http://localhost/ReceiveUpload.aspx" >
<input name=hid1 type=hidden value="test123">
<input name=hid2 type=hidden value="abcdef">
<input name=attach1 type=file size=20><br>
<input name=attach2 type=file size=20><br>
<input type=submit value="Upload">

Replace the URL "http://localhost/ReceiveUpload.aspx" with the URL for your server-side code. If your server-side code still reports 0 files, then something is wrong on the server-side.

First check to see if your site has any limits set on the size of HTTP requests it will accept. Does the sum of the sizes of the uploaded files (in a single request) exceed this limit? If so, then this could be the problem. If not, then try getting an upload working using the browser to send the upload, and some very standard ASP or ASP.NET code to receive the upload. For example, some very simple ASP.NET code to receive an upload w/out using Chilkat is shown here:

If the browser can successfully send the upload to the non-Chilkat server-side code, then you've proven that HTTP uploads can work from that particular client to your server. Swap out the browser with your app code. Does the upload still work? If not, then the problem is w/ the client-side. Use the Chilkat.Http.SessionLogFilename property to generate a log of the exact HTTP (upload) request being sent. Examine it to see if makes sense. Also check the Http.LastErrorText property after calling the method that does the upload. Does anything look unusual?