This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14834|Reply: 0

[ASP.NET] Asp.Net Get the file path, file name, and extension of the FileUpload control

[Copy link]
Posted on 8/11/2015 11:13:17 AM | | |
string fileNameNo = Path.GetFileName(FileUploadImg.PostedFile.FileName); Get the file name and extension
string DirectoryName = Path.GetDirectoryName(FileUploadImg.PostedFile.FileName); Get the directory where the file is located
string Extension = Path.GetExtension(FileUploadImg.PostedFile.FileName); Get the extension
string fileName = Path.GetFileNameWithoutExtension(FileUploadImg.PostedFile.FileName); Get the file name (excluding the extension)
string fullPath = Path.GetFullPath(FileUploadImg.PostedFile.FileName); Get the absolute path to the file
string PathRoot = Path.GetPathRoot(FileUploadImg.PostedFile.FileName); Get the partition where the document is located




Previous:C# reads Excel 2007 files
Next:The "Microsoft. ACE.oledb.12.0" provides a workaround
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com