获取浏览文件的路径 [英] To get the path of browsing file

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

问题描述

亲爱的朋友

我想获取要上传的文件的路径。当我们浏览文件时,我希望在文本框中显示此路径,以便我可以在数据库中存储此绝对路径。 br />
请帮帮我。



提前致谢。

Akhilesh Pathak

Dear Friends
I want to get the path of a file to be uploaded.I want this path in a textbox when we browse the file so that I can store this absolute path in databse.
Please help me.

Thanks in advance.
Akhilesh Pathak

推荐答案

这是你可以得到的:

This is what you can get:
string path = FileUpload1.PostedFile.FileName 



AFAIR,由于安全原因,最近的浏览器不再传递完整的文件路径。



看看下面关于类似主题的讨论:

FileUpload丢失目录路径。 [ ^ ]

FileUpload.PostedFile.FileName未在chrome中提供完整路径 [ ^ ]


如果这是真的ASP.NET,这是一个带浏览器的客户端/服务器系统,那么你就不能。

除了名字之外,安全不会让你知道任何事情。文件 - 客户端甚至可能没有浏览器后面的文件系统(它可能是b你所知道的一个支持互联网的冰箱)你的服务器无法提供有关它背后的任何信息。
If this is really ASP.NET, and this is a client/server system with a browser, then you can''t.
Security will not let you know anything except the name of the file - the client may not even have a file system behind the browser (it could be an internet enabled fridge for all you know) and your server cannot file out anything about whatever is behind it.


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

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