使用fileupload控件获取文件的完整路径 [英] get full path of file using fileupload control

查看:84
本文介绍了使用fileupload控件获取文件的完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我在项目中使用文件上传控件,但是我无法获取文件的完整路径,因此有人可以帮助我解决此问题.
例如.所需路径F:\somedirectory\sub\filename.extention
谢谢.

Hi Friends ,

i am using file upload control in my project but i failed to get full path of file so anybody help me to solve this problem.
eg. required path F:\somedirectory\sub\filename.extention
Thank You.

推荐答案

这里是您的链接,请检查它.

http://weblogs. asp.net/ashicmahtab/archive/2009/05/20/fileupload-control-doesn-t-give-full-path-help.aspx [
Here is the link for you, check it.

http://weblogs.asp.net/ashicmahtab/archive/2009/05/20/fileupload-control-doesn-t-give-full-path-help.aspx[^]

Thanks
--RA


尝试

try

Server.MapPath(FileUpload1.FileName);



希望对您有所帮助.



Hope it helps.


使用FileUpload控件时,不需要文件的完整路径.

只需单击"Submit"或"Upload"按钮,您只需检查FileUpload1.HasFile属性,然后使用
将文件保存到任何路径的服务器上
FileUpload1.SaveAs(pathOnServer);

FullPath不会显示为安全措施,以避免将客户端计算机的文件夹结构或驱动器暴露给服务器.
When you are working with the FileUpload control , you dont need the full path of the file where the file comes from.

Instead on the click of "Submit" or "Upload" button, you just need to check the FileUpload1.HasFile property and then save the file to the server on any path using

FileUpload1.SaveAs(pathOnServer");

The FullPath is not displayed as a security measure to avoid exposing the client''s machine''s folder structure or drives to the server.


这篇关于使用fileupload控件获取文件的完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆