Persits Software, Inc. Knowledge Base Articles

Object required: 'Upload.Files(...)' error

Problem Description

When uploading a file with AspUpload, the line of code

Response.Write Upload.Files("FILE1").Path

generates the following error in case no files were selected via the box <INPUT TYPE="FILE" NAME="FILE1"> :

Microsoft VBScript runtime (0x800A01A8)
Object required: 'Upload.Files(...)'

Solution

To check at run time whether a particular form item was used to select a file, the following syntax may be used:

Set File = Upload.Files("FILE1")
If File Is Nothing Then
  Response.Write "file not selected."
Else
  Response.Write File.Path
End If