ServerName Property

 Object: SoftArtisans.FileUp
 Syntax: ServerName
 Type: String
 Read/Write: Read Only
 Description: This property displays the complete path and name of the uploaded file on the web server's hard disk.

Before a Save, SaveAs or SaveAsBlob is executed, the ServerName property contains the location of the temporary cache file used when processing uploads. After a Save, SaveAs or SaveAsBlob, ServerName displays the complete path and name of the final location of the file.

The cache filename is always guaranteed to be unique. You can use the .ServerName property to generate a unique name when saving the file. The cache file's name is of the form saNNNN.tmp, where NNNN is a unique number. See Example 2, below.

If there is more than one file being uploaded in a single page, only the first one is displayed.

To examine the Server Name of multiple files in a single upload, there is an equivalent property for each file object, i.e., upl.FormEx("FILE1").ServerName.

Example 1:

	<%
	Set upl = Server.CreateObject("SoftArtisans.FileUp")
	upl.Path = "c:\temp"
	filename = "upload.tst"
	Response.Write("The uploaded file is now cached in:" & upl.ServerName & "<BR>")
	Response.Write("Saving the file to : " & filename & "<BR>")
	On Error Resume Next
	'---
	'--- Save the file now
	'---
	upl.SaveAs filename
	if Err = 0 Then
		Response.Write("Upload saved successfully to " & upl.ServerName)
	Else
	... %>

ServerName displays 'c:\temp\upload.tst'

 

Example 2:

	<%
	Set upl = Server.CreateObject("SoftArtisans.FileUp")
	upl.Path = "c:\temp"
	'--- NewFilename will be 'saNNNN.tmp'
	NewFilename = Mid(upl.ServerName, InstrRev(upl.ServerName, "\") + 1)
	'--- NewFilename will be 'saNNNN.sav'
	NewFilename = Left(NewFilename, InstrRev(NewFilename, ".")) & "sav"
	upl.SaveAs NewFilename 

 

Previous Page Next Page