本文介绍了如何从上传的文件中获取完整路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在obout文件上传控件中获取所选文件的完整文件路径?
而不将该文件保存在任何其他文件夹中,如fileUpload1.SaveAs(Server.MapPath(Files /) + filename));
能够获取文件名但不能获取文件路径。
How to get the complete file path of the selected file in obout file upload control?
without saving that file in any other folder, like fileUpload1.SaveAs(Server.MapPath("Files/"+filename));
able to get file name but not file path.
推荐答案
System.IO.Path.GetFullPath(FileUpload1.PostedFile.FileName);
Path.GetFileName(FileUpload1.PostedFile.FileName);
System.IO.Path.GetDirectoryName(FileUpload1.PostedFile.FileName).ToString();
Convert.ToString(System.IO.Directory.GetParent(FileUpload1.PostedFile.FileName));
这篇关于如何从上传的文件中获取完整路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!