These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

uploadedFile.FullPath returns file name not path

Hello,

When using the construct below to retrive the file path, it only returns the file name. Using uploadedFile.FullPath is exactly the same as using uploadedFile.Name

private void FileVistaControl_ Uploaded(object sender, FileVistaUploadedEventArgs e) 

//You can use e.RootFolder.MapPath(e.RelativePath) to 
//get the physical path of only the folder that the files are uploaded to 

//Get the paths of the uploaded files by walking through UploadedFiles collection 
string filePaths; 

foreach (GleamTech.Web.FileTransfer.UploadedFile uploadedFile in e.UploadProgress.UploadedFiles) 
filePaths += uploadedFile.FullPath + ", "; 

Mauro 3/16/2009 7:07 AM
Hi,
The property uploadedFile.FullPath is not the path of the file on the server. It's the path of the file which is sent from the client. Some browsers send the full path and some send only the file name when uploading files. Thus you may see the same value for both FullPath and Name properties.

Note that you can already see the answer in the comment above. You should use e.RootFolder.MapPath(e.RelativePath) to get the path where the file is actually uploaded. Then you can combine file name with this path to get the full path of the file:

System.IO.Path.Combine(e.RootFolder.MapPath(e.RelativePath), uploadedFile.Name)
Cem Alacayir 3/25/2009 5:52 PM