Class: SoftArtisans.FileUp
Method: Delete ([in,optional] Filename)
Description: This method deletes a file from the web server's hard disk.
If a filename is specified, it must contain the entire valid path.
If no file is specified, the current uploaded file will be deleted. This allows you to effectively cancel an upload. If there is more than one file being uploaded in a single page, only the first one will be deleted.
To delete multiple files in a single upload, there is an equivalent method for each file object, i.e. upl.Form("FILE1").Delete.
Example 1:
<%
upl.SaveAs filename
if Err = 0 Then
Response.Write("Upload saved successfully to " & upl.ServerName & "<BR>")
'---
'--- Perform some other processing here, such as writing to a database
'---
'--- Assume some error occurred - delete the uploaded file
'---
upl.Delete
If Err <> 0 Then
Response.Write("An error occurred when attempting to delete the uploaded file.<BR>")
Else
Response.Write("Uploaded file has been deleted.<BR>")
End If
Else
... %>
Example 2:
<% upl.Delete Request.Form("FILE1") %>