Click here to Skip to main content
15,889,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,
I am facing problem with Firefox ,not getting full path of selected file from input type file in jquery ,its working fine with IE

eg .when i select file "c:\demo\image1.jpg" in input file. IE give same path in jquery but Firefox give only file name "image1.jpg" because of this i am not able to save image . in database

Please suggest solution for this.
Posted
Updated 20-Mar-13 5:42am
v2
Comments
ZurdoDev 20-Mar-13 12:04pm    
This should not prevent you from saving the file in the database. It is a built-in security feature of FireFox. In fact, Google chrome will add c:\FakePath\image1.jpg. Your code should not be able to access the client's hard drive so that is why the browser restricts it. A file upload control should still be able to work though.
Samar chougule 20-Mar-13 13:49pm    
Thanks ryanb31,
problem is that i want this path in jquery not in code behind file ,by passing url through webmethod i am converting image into byte and then saving into database ,this working fine IE but FF gives problem

1 solution

AFAIK, there is no solution to it. Recent browsers do not pass on the full filepath any more because of security reasons.

This is what you can get that too in code behind:
C#
string path = FileUpload1.PostedFile.FileName 


Have a look at the following discussions on similar topic:
FileUpload loses directory path.[^]
FileUpload.PostedFile.FileName not giving full path in chrome[^]
 
Share this answer
 
Comments
Samar chougule 20-Mar-13 13:47pm    
Hi Sandeep thanks ,
problem is that i want this path in jquery not in code behind file ,by passing url through webmethod i am converting image into byte and then saving into database ,this working fine IE but FF gives problem
Sandeep Mewara 20-Mar-13 14:24pm    
Even in jQuery, whatever browser puts in input box, only that will be retrieved.

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