File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes setting upload path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "setting upload path" Watch "setting upload path" New topic

setting upload path

sujendra sugur

Joined: Mar 25, 2010
Posts: 12

hi everybody,

I have a problem in uploading images. the problem is , in form i want to set paths as defaultly selected with out browse button and when
i hit submit those file to be upload into server.

Please tell me how to set path default

thank you
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

If you're trying to do what I think you are, you can't.

Browsers are intentionally designed not to allow a web app to fetch files from the file system.
The <input type="file" ...> tag was specifically stripped of the capability to modify it's value attribute via Javascript to insure that web developers don't try to find loopholes around this.

This is a good thing.
Imagine if any site you went to had the capability to grab files (like you're windows registry) from a hidden iframe without your knowledge.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
subject: setting upload path
Similar Threads
prob in getParameter
uploading file using ClientHttpRequest2 and FileUploadServlet
how to set selected path to struts html:file when it redirects to same page
Help with Castor
how to set FormFile