Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Javascript jQuery , +
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
 
C:\fakepath\DSC101. 
 
And in Mozzilla
 
DSC101.jpg
 
but i need the full original path to upload the file....
 
HTML CONTROL
 
<input type="file" name="file-input" id="FIP_PIC" value="" class="file validate[required]">
 
JAVASCRIPT to read the file path.
 
var _Profile_PIC = document.getElementById('FIP_PIC').value;
 
How to get the original Path using javascript...
 
Please help me...
 
Thanks & regards,
 
Dileep
Posted 7-Apr-13 3:55am
dilzz1.2K
Edited 7-Apr-13 3:57am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
dilzz at 7-Apr-13 9:07am
   
Then how to upload the file..???
OriginalGriff at 7-Apr-13 9:20am
   
Use the FileUpload control
http://asp.net-tutorials.com/controls/file-upload-control/
dilzz at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 9 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100