Delete Method

 Object: SoftArtisans.FileUp
 Syntax: Delete ([in,optional] Filename)
 Description: This method deletes a file from the web server's hard disk.

If you specify a Filename, it must contain the entire valid path.

If you do not specify a Filename, the current uploaded file is 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 is 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 strFileName
	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") %>

 

Previous Page Next Page