Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

browse button returning just filename in Firefox

 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

once after selecting the filename and submit the form the firefox is sending only the filename without the full path.
for eg: if i select a file c:\text.htm the firefox is returning just text.htm as parameter.
Is there a way to pass the full path as parameter.
In IE it is working fine.
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anybody know the answer?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this.
[ June 01, 2007: Message edited by: Bear Bibeault ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think firefox returns the fill path as a security measure.

what are you doing on the server to try to get the full path?

Eric
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
user should select a xml file from browse button and the server will parse the xml file and update the database accordingly. since firefox is returning just filename the servlet is not able to get the xml file
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vijaya bacina:
since firefox is returning just filename the servlet is not able to get the xml file


You should not need the file path in any case. How are you reading the file, with file I/O or with a file upload?

If the former, your system will ONLY work when the client and the server are on the same machine. Is this what you really intened?
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


where path=document.form.browse.value; which is equal to text.xml
file.exists() is returning false so not able to read the file.
the server and client will be on different machines. Is this not possible with firefox atall?
 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firefox has nothing to do with it. If that code you posted runs on your server, then the File object refers to a file on your server, not to a file on the client. That just isn't how you upload a file, so there is no point in trying to make it work.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JSP FAQ on how to really perform a file upload.
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
I used apache commons for file upload and it is working fine now.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
Olly Morgan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I have a similar problem, which is not solved by the JSP FAQ...

In our case we are not trying to upload the file, just allow users on our intranet to specify where their file is, and using the Browse button avoids mistypes... it's part of an application where users specify future deployments, and this is part of the documentation they are providing. So we are not (at this stage) interested in the file, only where it is. So, as much as I understand that the primary function of the Browse button is for uploads, Firefox's behaviour is kind of unhelpful.

Any one have any suggestions as to whether Firefox can configured so that the browse button does not have this security feature? Or any Javascript examples that allow a user to select a file.

Thanks for any help

Olly
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I'm afraid that you will have to search for another solution.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic