Welcome Guest Search | Active Topics | Sign In | Register

How do I save the file name in as a different name from the client name? Options
risarc
Posted: Monday, March 30, 2009 5:20:51 PM
Rank: Newbie
Groups: Member

Joined: 3/27/2009
Posts: 1
Same code where a file "A.pdf" at tha client is uploaded and saved as B.pdf on the destination folder. How do we do this in the AJAXUploadControl


Sample code below:

If (myFile.PostedFile.FileName <> "") Then
Dim strFileNameOnly As String = myFile.PostedFile.FileName.ToString()

' DEfine the File Path And New Name of file that is associated to the ID.
Dim FilePathOnServer As String = System.Configuration.ConfigurationManager.AppSettings("DocPath").ToString() & Request.QueryString("TransactionID") & myFile.PostedFile.FileExtension

myFile.PostedFile.SaveAs(FilePathOnServer)
lblMsg.Text = "File Upload Was Successful."
Else
lblMsg.Text = "File Upload Denied."
End If
End If
eo_support
Posted: Monday, March 30, 2009 5:26:51 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

AJAXUploader already saved the files into a temp file for you. You will need to call File.Move to rename it to whatever new name you would like to use. Please see this topic for more details:

http://doc.essentialobjects.com/library/1/ajaxuploader/ajaxuploader_behavior.aspx

The topic also contains sample code on how to move the temp files to a new location. You are free to change the file names during this process.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.