AspUpload 2.0

Frequently Asked Questions

Copyright (c) 1998 - 2000  Persits Software, Inc.
Q1. I want to let my users specify the destination directory to which the files will be uploaded.  I included  <INPUT TYPE="TEXT" NAME="PATH"> in the form, and my upload script looks like this:
<% n = Upload.Save(Upload.Form("Path")) %>. However this does not seem to work.

A. You can not use the Form collection before calling Save because it is not yet populated. The right way to do it is to upload the files to a temporary directory and then copy or move them to the specified destination directory as follows:

<%
n = Upload.Save "c:\upload"
For Each File in Upload.Files
File.Copy Upload.Form("Path") & "\" & File.ExtractFileName
Next
%>



Q2:  Will AspUpload work with any version of ASP?

A:  No. Early versions of the ASP's Request object did not provide the BinaryRead or TotalBytes methods which the component heavily relies on. The best way to test whether your version of ASP allows uploading is to execute a simple script like <% n = Request.TotalBytes %> and see if the method is recognized by your ASP module.



Q3:  Where can I get the latest version of ASP?

A. You need to install the Microsoft Option Pack 4.0.



Q4: Whenever I try to upload a file I am getting the error Persits.Upload.1 error '800a0003', Nothing has been posted. Why?

A: One possible reason is that your version of ASP is old. See Q2 and Q3. Another possible reason is that you forgot to include the METHOD=POST attribute in your form.



Q5: I am getting the error Persits.Upload.1 error '800a0001', Request.BinaryRead Failed. What does it mean?

A. In most cases it means that your upload script calls the Request object prior to calling Upload.Save. You must never use Request.Form in your upload script, use Upload.Form instead.. It may also mean that your version of ASP is old and does not support the Request.BinaryRead method. See Q2 and Q3.



Q6:  Why am I getting the following error:

Microsoft VBScript runtime error '800a01ad'
ActiveX component can't create object

A. It is a permission problem. Make sure Everyone has Full Control over AspUpload.dll.



Q7: When uploading large files, my script times out. What can I do to prevent this?

A. Set the Session.Timeout property to some large number such as 200 (in minutes) before calling Upload.Save.



Q8: I am using the control  <SELECT NAME="Choice" MULTIPLE> in my upload form. I noticed that Upload.Form("Choice"), unlike Request.Form("Choice"), only returns one of the selected string. Is it possible to access all selected strings in this control?

A. Yes. Unlike Request.Form, the Upload.Form collection will store each selected string as an individual item, but under the same name. You can access all selected strings as follows:

<%
For Each Item in Upload.Form
    If Item.Name = "Choice" Then Response.Write Item.Value & "<BR>"
Next
%>



Q9. When I attempt to upload a file I always get the following error. Why?

Persits.Upload.1 error '800a0005'
Access is denied.

A. This is an NTFS permission problem. The current user (such as IUSR_xxx) must have Full Control over the upload directory to be able to create files in it. You can instantly fix this problem by giving Everyone Full Control over the upload directory, then tighten security as appropriate.



Q10. I want to use the LogonUser method to impersonate an admin account in order to be able to save files on a remote machine. However, I always get the error

Persits.Upload.1 error '800a001e'
A required privilege is not held by the client.

A. Most probably, your virtual directory has the "Run in separate memory space" option checked. This causes Windows NT to disallow calling LogonUser unless the user has the privilege "Act as Part of Operating System". You have two options: disable "Run in separate memory space" for this virtual directory, or grant this privilege to all the users of your application such as IUSR_xxx (go to User Manager, select Policies/User Rights, check "Show Advanced User Rights", select "Act as Part of Operating System", add desired users).



Q11. I am trying to specify a default value for an <INPUT TYPE=FILE> item on my form, but the browser seems to ignore the VALUE attribute of this tag. Client-side JavaScript does not help either. Is there a way I can programmatically specify a file for uploading?

A. No, and there is a good reason for that. If setting a default value for <INPUT TYPE=FILE> were allowed, one could easily write an HTML page that would steal files from a user's machine without his/her knowledge or permission. Although pure HTML won't help you, there is still a way to specify a file for uploading programmatically: use a client-side upload agent such as the XUpload ActiveX control available from www.aspupload.com.


For more information on AspUpload visit the www.aspupload.com web site or write to support@aspupload.com.