This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 File Upload - Client's filepath

 
Mathew Geraldo
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me please...
We are using Struts2 file upload tag in my jsp for our users to upload a file.
In my action class, I could get the fileName that the user uploaded but is there a way I can get the entire filePath on client's machine?
If it is not possible, is there any other work around for me to do this.

 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mathew. Getting the full file path on the clients machine is not possible. Browsers do not allow you to expose this kind of information to the webpages since it will be a huge security risk. By exposing the clients directory structure, a potential hacker may be able to retrieve any file from the filing system .
 
Mathew Geraldo
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif, thank you so much !!
 
Mathew Geraldo
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif, Thanks for your clarification.
We have a similar application (not in struts) that captured the entire client path.
So is the reason I was trying to check if we could do the same with struts2.
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a similar application (not in struts) that captured the entire client path.

Can I ask how were you achieving that ? By an ActiveX object ?
 
Mathew Geraldo
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif,
All I know is that the application was written in PERL CGI .
So maybe there is something in PERL/CGI that would allow access to clients file path.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It used to be the case that Internet Explorer would upload the whole path, instead of just the file name. Other browsers don't do that, because of the security risks referred to in an earlier post. Perhaps recent versions of IE have fixed this problem -- I don't know because I haven't checked.

Perhaps your clients were all IE users?
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif,
All I know is that the application was written in PERL CGI .
So maybe there is something in PERL/CGI that would allow access to clients file path.

I see, I'll take a look at it just for knowledge purposes.

It used to be the case that Internet Explorer would upload the whole path, instead of just the file name. Other browsers don't do that, because of the security risks referred to in an earlier post. Perhaps recent versions of IE have fixed this problem -- I don't know because I haven't checked.

Perhaps your clients were all IE users?

Yes Paul , I can say about the older versions of IE ( prior to 7 ) , they used to send the complete physical address of the clients file system instead of just the file name although I am also not sure about the newer versions of IE. Maybe Mathew's was a very particular scenario where all clients were supposedly using an old IE version.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic