Class: SoftArtisans.SAFile
Property: IsEmpty
Type: boolean
Read Only
Description: This property displays whether or not the user specified a valid file to upload.
When a user is filling out a form containing a file (<INPUT TYPE="FILE">), there are three possibilities:
In cases (2) and (3), the browser does not report an error. The browser simply proceeds with the upload but leaves empty the file contents of the upload.
Also, it is typically not possible to validate the user's entry from client-side scripting. Client-side scripts are often not allowed to read files on the local PC. Also, to protect the user's private data, Client-side scripts cannot modify the contents of file input field. (Otherwise it would be possible for a nefarious web site to steal files off of a user's PC).
The recourse is to let the user perform the upload and verify the IsEmpty property.
If the property is true, then the user did not transmit a valid file.
If the property is false, then the user did transmit a valid file.
Example:
<%
Set upl = Server.CreateObject("SoftArtisans.FileUp")
'---
'--- Set the default path to store uploaded files.
'---
upl.Path = "c:\temp"
if upl.Form("FILE1").IsEmpty Then %>
The file that you uploaded was empty. Most likely, you did not specify a valid
filename to your browser or you left the filename field blank. Please try again.
<% ElseIf ... %>