Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Experts,

I am Doing an ASP.net project. In that project am using Ajax JSON to transfer the datas.

And am Using Javascript to read the datas from controls.

But I am facing a Problem,

I didn't get the Original File path when i used the file Input HTML Control...

In Chrome i get

HTML
C:\fakepath\DSC101. 


And in Mozzilla

HTML
DSC101.jpg


but i need the full original path to upload the file....

HTML CONTROL

HTML
<input type="file" name="file-input" id="FIP_PIC" value="" class="file validate[required]">


JAVASCRIPT to read the file path.

JavaScript
var _Profile_PIC = document.getElementById('FIP_PIC').value;


How to get the original Path using javascript...

Please help me...

Thanks & regards,

Dileep
Posted
Updated 13-May-21 4:18am
v3
Comments
Vishal Panchal Sep2022 24-Mar-23 8:29am    
from this i am getting

Path : c:/fakepath/actualfilename

Instead can i get whole actual path??

 
Share this answer
 
You can't.
Security stops you for knowing anything about the filing system of the client computer - it may not even have one! It could be a MAC, a PC, a Tablet or an internet enabled fridge - you don't know, can't know and won't know. And letting you have the full path could give you some information about the client - particularly if it is a network drive for example.

In fact you can get it under particular conditions, but it requires an ActiveX control, and will not work in 99.99% of circumstances.

You can't use it to restore the file to the original location anyway (as you have absolutely no control over where downloads are stored, or even if they are stored) so in practice it is not a lot of use to you anyway.
 
Share this answer
 
Comments
dilzz 7-Apr-13 9:07am    
Then how to upload the file..???
OriginalGriff 7-Apr-13 9:20am    
Use the FileUpload control
http://asp.net-tutorials.com/controls/file-upload-control/
dilzz 7-Apr-13 9:22am    
can we use with HTML control.??

Facebook like sites are used HTML Controls to upload the pictures.. right naa..?? then how they are handle this issue..??

Thanks ur reply.....

Dileep

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900