• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems with oreilly.servlet.MultipartRequest- help!

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
java.io.FileNotFoundException: /home/sites/www.iponly601.com/web/live/images/mock3.gif
(Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
at java.io.FileOutputStream.<init>(FileOutputStream.java:62)
at java.io.FileOutputStream.<init>(FileOutputStream.java:132)
at com.oreilly.servlet.multipart.FilePart.writeTo(FilePart.java:144)
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:139)
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:75)
at _live._admin._preview__jsp._jspService(/live/admin/preview.jsp:48)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:176)
at com.caucho.server.http.Invocation.service(Invocation.java:278)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
at om.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:338)
at .caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:270)
at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at java.lang.Thread.run(Thread.java:484)
//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.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Thanks
Mark
reply
    Bookmark Topic Watch Topic
  • New Topic