Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 216
Product
FileUp
Version
2.x, 3.x
Title
Downloaded file is corrupted, containing meaningless characters
Problem

When attempting to download a file using FileUp's TranferFile method, the downloaded file is full of meaningless characters, such as the following:

 helloÐÏ à¡±á>þÿ"$þÿÿÿ!ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ      

Solution

When the TransferFile method is called, FileUp gets the desired file on the server, and outputs the bytes of the file in the response stream to the user's browser. FileUp does not alter the file's contents in any way.

The most common cause of corruption of a downloaded file's contents, is the inclusion of HTML or Response.Write statements into the ASP code of the download processing page.

As an additional precaution, you can explicitly clear the Response buffer before calling TransferFile or TransferBlob (assuming your Response.Buffer is set to True, which it normally is by default):

<%
Response.Clear
objFileUp.TransferFile filename
Response.End
%>

Any attempts to output HTML content of any type (i.e. message text, tags) will mix HTML content into the download stream and corrupt the file.

Most often, these Response.Write statements are included in code to assist in debugging the code. Then, at deployment, they are overlooked and not properly removed.

One additional factor which can cause this problem is if you have server-side debugging turned on for your FileUp download application. To check this, go to the IIS console on the server. Right-click on the application containing your ASP download pages. Choose properties. In the bottom section of the main tab, containing the application settings, click . Then click on the app debugging tab. If enable server-side script debugging is checked, please uncheck it.

Please note: If your FileUp ASP download page contains Server-Side Includes, you must be sure to verify that these includes do not contain any attempts to generate HTML output either, or the same garbled results will occur.

In conclusion, in order to download a file correctly using FileUp, be sure that you have not corrupted the download stream with HTML output. The download processing page must contain pure server-side script.

Created : 12/1/2002 12:00:00 AM (last modified : 10/25/2001 2:20:00 PM)
Rate this article!
Comments