Revision history [back]

click to hide/show revision 1
initial version

answered 2021-03-17 10:22:19 +0800

cor3000 gravatar image cor3000

That's quite an unusual question. I think I don't fully understand your scenario to give any hints. As of now what you ask for seems impossible.

Without uploading there won't be a file existing at the server so you won't get a path for it. If you wanted to display the path on the client system then you're also out of luck since you don't have direct access to it.

So the question is, what do you really need, file upload doesn't seem like the right tool, obviously it's meant for uploading files.

That's quite an unusual question. I think I don't fully understand your scenario to give any hints. As of now what you ask for seems impossible.

Without uploading there won't be a file existing at the server so you won't get a path for it. If you wanted to display the path on the client system then you're also out of luck options since you don't have direct access to it.the client side file system from the server.

So the question is, what do you really need, file upload doesn't seem like the right tool, obviously it's meant for uploading files.

That's quite an unusual question. I think I don't fully understand your scenario to give any hints. As of now what you ask for seems impossible.

Without uploading there won't be a file existing at the server so you won't get a path for it. If you wanted to display the path on the client system then you're also out of options since you don't have access the client side file system from the server.

So the question is, what do you really need, file upload need? Fileupload doesn't seem like the right tool, obviously it's meant for uploading files.

That's quite an unusual question. I think I don't fully understand your scenario to give any hints. As of now what you ask for seems impossible.

Without uploading there won't be a file existing at the server so you won't get a path for it. If you wanted to display the path on the client system then you're also out of options since you don't have access the client side file system from the server.

So the question is, what do you really need? Fileupload doesn't seem like the right tool, obviously it's meant for uploading files.

UPDATE 2021-03-18

to my current knowledge there is no way to obtain the path to a local file from within a browsers. Accessing information about he file system is deliberately prevented for security reasons (that includes absolut paths) ... even the file system api is only operating on a virtualised file system (https://developer.mozilla.org/en-US/docs/Web/API/FileandDirectoryEntriesAPI/Introduction#virtual).

If the browser has no access to it, then you can't send this information to the server.

The workaround you found via file upload will actually duplicate the file after uploading inside a temp folder inside the application server. Then this absolute path to the temp folder is used, not the original location.

If you find something giving you direct file system information from inside the browser you should file a bug the the browser vendor to get this fixed.

That's quite an unusual question. I think I don't fully understand your scenario to give any hints. As of now what you ask for seems impossible.

Without uploading there won't be a file existing at the server so you won't get a path for it. If you wanted to display the path on the client system then you're also out of options since you don't have access the client side file system from the server.

So the question is, what do you really need? Fileupload doesn't seem like the right tool, obviously it's meant for uploading files.

UPDATE 2021-03-18

to my current knowledge there is no way to obtain the path to a local file from within a browsers. Accessing information about he file system is deliberately prevented for security reasons (that includes absolut paths) ... even the file system api is only operating on a virtualised file system (https://developer.mozilla.org/en-US/docs/Web/API/FileandDirectoryEntriesAPI/Introduction#virtual).

If the browser has no access to it, then you can't send this information to the server.

The workaround you found via file upload will actually duplicate the file after uploading inside a temp folder inside the application server. Then this absolute path to the temp folder is used, not the original location.

If you find something giving you direct file system information from inside the browser you should file a bug the the browser vendor to get this fixed.

The only way I see is to ask the user to copy paste the absolute path directly into a textbox and then use this string at server side.

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More