This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
i searched a lot for this one before posting this.
my requirement in brief: i)User selects an image. ii)I need to read the image iii)Store it in server's file system. (Not in database as BLOB) iv)The image selected by the user should be made visible in a page. so i need to give a reference to the image uploaded thru src attribute in img tag of the webpage.
now the problem is how to accomplish the iii) and iv) steps. i'm able to read the file from client machine thru MultiPart concept and i'm able to accomplish the first 2 steps.
the problem becomes tricky bcoz all the clients shud be able to see the image and we need to set the src attribute such a way that it is global and not specific to any client/server's file system.
i tried to give relative path, but its not working.
am i missing something which is very simple. help is appreciated [ June 14, 2005: Message edited by: Bear Bibeault ]
Hi, How are you organizing the storage of your user uploaded files. Means, where exactly (in which folder) is those files stored.
Is it along with the webpart of the application ? , ie along with the META-INF folder and currently how are you accessing it and what is the problem you are facing ?
Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside HereWEBlog
Joined: Feb 04, 2005
thanx for the quick reply.
i'll make my pblm clearer. i'm able to read the file from the client machine ... means i'm getting the bytes. now my question is how to write those bytes to a file and where to store it so that it can be referenced by all the clients.
Senthil B Kumar
Joined: Feb 09, 2004
i guess we need information like where are you now currently storing your file (ie in which folder exactly).
For example, you can create an UserFiles folder in the Web part, along with the WEB-INF folder. Then write your files to this folder, note that it is better to use a relative path (relative to the context root of the application) to mention where to write the files.
Basically its relative and relative to context root of the application.
Joined: Feb 04, 2005
thanx for the hint.
this is what i was looking for, where to store the client file. stored here:request.getSession().getServletContext().getRealPath("/")
and then used relative path as u said for referring the file on server.