permaculture playing cards*
The moose likes Servlets and the fly likes I am facing problems in file uploading into my server location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

I am facing problems in file uploading into my server location

Suresh Entropy
Greenhorn

Joined: Nov 29, 2012
Posts: 3
I am facing problems in file uploading into my server location. The thing is, am testing locally upload by setting the file path it was working fine.But my development needs to be work in Production environment where i need to upload that file in respective server location(path). After this being done, i again need to convert that Client uploaded server location into a URL for previewing that Uploaded document by client in a JSP Page. Kindly help me in getting out of this nearly it taken most of my development time. Thanks in advance.

-- Suresh
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 838
    
  13

Suresh Entropy wrote:I am facing problems in file uploading into my server location. The thing is, am testing locally upload by setting the file path it was working fine.But my development needs to be work in Production environment where i need to upload that file in respective server location(path).


I would store the upload destination path as a context param in the web.xml. Then your code can just reference that parameter and it doesn't matter if you are working locally or on a server. Changing the path now is just a setting in web.xml and you don't have to touch the code.

Suresh Entropy wrote:After this being done, i again need to convert that Client uploaded server location into a URL for previewing that Uploaded document by client in a JSP Page.


This should be a simple matter of assembling the pieces. You can get the context from the servlet container (${pageContext.request.contextPath}), you have the upload path as a context param, and you have the filename somewhere (I would probably save it as a session attribute prior to the upload). That should be everything you need to build a URL.

If you still have problems, post your code and show us exactly where you are having problems, what you expect the code to do, and what it's actually doing.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Please dont post the same question multiple times, I am locking this one so that we can continue the discussion here .


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I am facing problems in file uploading into my server location
 
Similar Threads
How to give a path name in web.xml
Reading an Image
need to upload a file in server path using servlets and retrieve that path in url format?
progress bar and timeout functionality for file upload
Delete file from client system using Jsp / servlet