I have a file upload control on .aspx page where I am extracting basic file information. The requirement is that I need to save absolute path for selected file from client's machine to a db.
I have read on this site as well as else where that by nature ASP.NET doesn't allow to read information from client's machine for security reason.
But I am wondering if there is a way around this issue using js or something to get the absolute path and then pass it to asp.net variables?
You can't really do anything reasonable about this restriction.
Any fully trusted code on users' machine can do that. So your goal is to convince user to install something that will provide you with the information.
For Windows (all require instalation of some sort):
I believe almost all platforms also have ways to to so... with similarly painful installation requirements.
Browser send file without full file path, so to retrieve file path you do it on client side via javascript function:
If you don't want to send a file path via query string, you can create hidden form field, so file path will be sent via post.
You can't get full path of the file. For security purposes, the browser will never post the full file's path.
Try to use below code in java script.
You can't get client machine path. For security purposes, the browser will never post the full file's path.