• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

How to get the path of an Uploaded file?

 
Ranch Hand
Posts: 114
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i want to know how to get the path of an uploaded file.
I am uploading the file in a JSP Page (using HTML tags and i am not using multipart...) and the request.getParameter() for that file is in another JSP page. How do i get the path of the file uploaded. Please help me

-Ashish Mahajan
 
Marshal
Posts: 67313
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot upload a file without using a multipart request. And regardless, you cannot get the original path of the file except under IE which has a security bug that lets you see the path.
 
Aashu Mahajan
Ranch Hand
Posts: 114
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there no any alternative way to get the path??
Actually i want to get the path of an image file that is uploaded and want to copy that uploaded image file to a specific folder. so how should i do that when i can't get the full path of an uploaded file?
 
Bear Bibeault
Marshal
Posts: 67313
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What path are you asking about? The original path on the client or the path of the file after upload on the server? You can't get the former, the latter is wherever your code writes the file.
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Use javascript to set the file path to another hidden input in that form before submit the form.
 
Aashu Mahajan
Ranch Hand
Posts: 114
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok and can i uplaod, save and retrive image from the server?
 
this is supposed to be a surprise, but it smells like a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!