File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Problems with oreilly.servlet.MultipartRequest- help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problems with oreilly.servlet.MultipartRequest- help! " Watch "Problems with oreilly.servlet.MultipartRequest- help! " New topic

Problems with oreilly.servlet.MultipartRequest- help!

Mark Stringham

Joined: Nov 30, 2001
Posts: 12
I posted this question to the JSP forum but wonder if it might be applicable here.
I need some help.
I am using oreilly.servlet.MultipartRequest for file uploads and have the following issue.
When I submit to upload an image(from my desktop) to my server it is working fine - I can upload an image from my desktop to my images dir no problem.
But if I then select the same image on my desktop (that now exists in my images dir on the server) and try to upload it again (or basically overwrite it) I get the following error: /home/sites/
(Permission denied)
at Method)
at com.oreilly.servlet.multipart.FilePart.writeTo(
at com.oreilly.servlet.MultipartRequest.<init>(
at com.oreilly.servlet.MultipartRequest.<init>(
at _live._admin._preview__jsp._jspService(/live/admin/preview.jsp:48)
at com.caucho.jsp.JavaPage.service(
at com.caucho.jsp.Page.subservice(
at com.caucho.server.http.FilterChainPage.doFilter(
at com.caucho.server.http.Invocation.service(
at com.caucho.server.http.CacheInvocation.service(
at om.caucho.server.http.RunnerRequest.handleRequest(
at .caucho.server.http.RunnerRequest.handleConnection(
//end of stack
Any idea why I can't overwrite a file that already exists?
I have 777 permissions on the image directory I'm uploading to.
I am using RESIN on a linux box.
Any help is appreciated.
BTW - My upload app worked fine on my local machine and had no probs. This occured only after I moved it to a host.

A gentle push and a mild arc, and the cowhide globe hits home - Hot Rod Hundley
Jason Kilgrow
Ranch Hand

Joined: May 21, 2001
Posts: 47
Originally posted by Mark Stringham:
I posted this question to the JSP forum but wonder if it might be applicable here.
I need some help.

I would be interested to know how you are creating the file. I think the first thing I would consider is checking to see if the file exists first and, if so, deleting it before you create the new one.
Mark Stringham

Joined: Nov 30, 2001
Posts: 12
The file is simply uploaded from my desktop to the server - I'm unsure how the file is recreated.
How would I detect if the file exists on the server and then delete if it does?
Sounds like a good idea.
I agree. Here's the link:
subject: Problems with oreilly.servlet.MultipartRequest- help!
It's not a secret anymore!