Need Fully Qualified Path From 'Source' Computer
I am trying to get the full path from the client for files that are submitted for upload.
I want something like:
C://this/is/your/file.jpg
But, when I try:
m_Fil开发者_StackOverflowe = Request.Files[i];
m_File.FileName
I get "just" the file name.
And, when I try:
System.IO.Path.GetFileName(m_File.FileName)
I get a path that seems to point to my IDE:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PICT0736.JPG
I am using an HttpPostedFile collection on the server and hidden inputs with type=file (passed via iframe) to POST the file collection.
Ideally, I would like each input to have value="c://path/to/file.gif"
If you don't think this is possible or stylistically sound, I'd appreciate alternative suggestions (code examples especially appreciated).
Thanks for your efforts. :)
Browsers typically won't give you the fully qualified path, to avoid sending potentially sensitive information to web servers.
As I understand it, when sending a file with HTTP post, you only send the contents of the file, which doesn't include file system metadata such as file path. The only way I could see to solve this would to include the metadata manaully with a POST. Perhaps using some javascript and a hidden input field on the form to capture the provided file path and update it as the path provided changes?
精彩评论