Debugging HTTP Upload
HTTP upload requires code both client-side and server-side code to be functioning correctly. Imagine you are trying to do an HTTP upload from your application (using the Chilkat Upload component) and something is not working. How do you debug? Is the client-side application at fault? Is the Chilkat Upload component not working correctly? Is the server-side code that receives the upload not functioning correctly? (Remember, w/ HTTP upload you must write the server-side code to receive the upload.)
A good way to debug is to substitute a web browser (FireFox or Internet Explorer) for the client-side. You can be assured that the browser will perform the client-side of the upload correctly. If the upload fails using a browser, then the problem must be on the server-side. (Or it’s possible there are problems in your client-side application AND the server-side, but by using the web browser you can test your server-side independently of your client-side.)
To upload from a browser, simply create an HTML page with a form like this:
<html> <body> <form method="POST" enctype="multipart/form-data" action = "http://www.mywebserver.com/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"> </form> </body> </html>
The above form uploads two files, and also sends a few extra (non-file) form fields. To upload a single file, simply remove one of the “input” HTML tags.
In summary: If the upload using a browser fails, you should focus on getting your server-side code working correctly. Once uploading with a browser is successful, you should then test your client-side code. It is now known that your server-side code is receiving the upload properly, so if your client-side code fails, there must be a problem with it.