Frequently Asked Questions
Where are the uploaded files saved?
The uploaded files are saved in a directory in the same computer where the ASP code is running. When you install the script, you specify that directory through the 'uploadsDirVar' variable. This variable must indicate the pathname of a directory with writing permissions for the web server.
I am hosting my ASP scripts in the web server of a hosting company (not my own computer) and I don't know the pathname of the host's directories; how can I set the 'uploadsDirVar'?
Usually, the hosting company has documentation about this. You can also just contact them and ask them.
Can the 'uploadsDirVar' path be a shared drive (such as \\computername\drivename\etc)? Can it be a relative path? Can it be an ISS Virtual Directory?
You should be able to use shared drives, depending on the configuration of the web server. I don't know much more about it.
You should be able to use relative paths (..\something\etc).
You cannot use Virtual Directory because ASP's FileSystemObject does not work with that.
How do I make the upload page restrict the types of files that the user can upload, even before they are uploaded?
Is it possible to restrict certain uploads based on file size?
I am trying to upload a really large file, but the upload fails; what can I do?
First of all you must make sure you can see any possible error message that the server may be posting. To enable all error messages in Internet Explorer, go to Tools/Internet Options/Advanced and make sure the following options are NOT checked:
After you make those changes to IE, try to upload again. If you see a "007~ASP 0104~Operation not Allowed" error, then follow the instructions in the requirements page of this site. That page has instructions about configuring the "maximum request allowed" value in the web server.
If after you change maximum request allowed value (and maybe after restarting the server), you still can't upload a large file, try changing the ScriptTimeout value at the top of the uploadTester.asp page (the value is in seconds).
How do I grab the filename of the uploaded file?
It depends on how the file was saved. If the files were saved with the regular Save method, you get the name of the uploaded file from the Upload.UploadedFiles(fileKey).FileName command, where fileKey is the name of the control in the form. In the case of the uploadTester.asp script, the fileKey for the first file is attach1. See the function SaveFiles in uploadTester.asp for an example of the use of the FileName property.
If you used the mehtod SaveOne, you get the file name from the argument of the method itself, because the name may have changed on wirting to avoid overwrites. For more information on the Save ad SaveOne methods see the reference guide.
Is it possible to upload files with iternational names (like àéãç.txt)?
Yes. If after the file was uploaded, you see it in the server but the name has changed, check that your upload page follows all the rules for international characters as described in the documentation. You should also make sure that your ftp client, which you are using to look at the uploaded files, supports international filenames. In some cases the ftp client may change some of the characters (but the real name of the file is correct on the server); in other cases it may even hide such filenames.
My upload form has two type="file" input elements. On the server side, I want to be able to know which file came from the first input field and which came from the second. How can I do this?
The values of the keys of the UploadedFiles property of the FreeASPUpload object are the names of the type="file" input elements in the uploading form. For example, for the uploadTester.asp script, the input element names are "attach1", attach2", attach3", and "attach4". Through the key values, the server-side script can figure out the origin of each uploaded file.
Can I change the name in the form elements <form type="file" name="...">?
You can use any name for these form fields.
I am trying to pass a text field to the uploadtester.asp page but when I use strUserName = Upload.Form("somefield") I get an error saying Microsoft VBScript runtime error '800a01a8' Object required: 'Upload'. What can I do?
The reason you are getting that error is that you are trying to use the Upload object without it being created first. If you want to use the uploadtester.asp page to test your usage of Upload.Form("somefield"), please add your statement at the bottom of the SaveFiles function in that page.
My form has a textarea input element, and I cannot get the value of this element using Upload.Form. Is this a known problem?
Yes, others have reported that limitation. The problem seems to happen only with WindowsServer 2000, not with WindowsServer 2003.
I don't kow why this happens (haven't had much time to investigate). If someone out there has information on corrective measures or bug fixes, please contact me.
How do I rename the uploaded file?
Use the FreeASPUpload script to save the file with the original name, and use the MoveFile method of ASP's FileSystemObject to rename it.
Is it possible to show a progress bar while the file is being uploaded?
I don't think that is possible with the simple approach to upload used by FreeASPUpload. The file or files to uload are sent by a POST method in a FORM, and then processed by a regular ASP page.
Usually a progress bar is made by the Response object sending some small pieces of HTML to update that bar. However, in this FORM POST scenario the Response object does not send any HTML until the Request object is done receiving the data. Even adding a Response.Buffer=False makes no difference. If you know of a way, let me know and I will implement it.
If your question is not answered here: