• 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

Eclipse fileupload no longer works

 
Greenhorn
Posts: 11
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to migrate an app I wrote with a text editor into Eclipse and am finding that it's no easy task.

Numerous hurdles have been leaped over but this one has me stumped.
I have a servlet to upload an image (chosen by the user) and write it to the users account folder on the server.
Goes a little like this:


there's some Japanese in the comments there if you're getting funny symbols
I put in a whole lot of printlns to see where it broke and it's at the:
item.write(uploadedFile);
line.

Here's the console dump:
and on it goes... but that's probably enough.

Am I using the wrong upload class?
Should I use something in Eclipse instead of Apache?
What's with that huge file name in the FileNotFoundException?

I sure would like to know what is going on here.
It was working before I moved it onto Eclipse, by the way.

Oh, and you probably want to know that I'm using:
Eclipse Java EE IDE for Web Developers.
Build id: 20090920-1017

Much appreciated if any Eclipse experts out there could shine a light on this one for me.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Bartels wrote:What's with that huge file name in the FileNotFoundException?


That would be the huge clue pointing at what's wrong. Too much code in one method and too many superfluous comments to find it, though.

I can tell you what browser you're using to do the upload, though.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should read the javadoc for the File constructor, specifically what you get when you do this:

uploadedFile = new File(realPath, fileName);

Your printlns printed out the values of realPath and fileName, so the long resulting file name should not be any surprise.

By the way, this post has nothing to do with Eclipse.
 
Paul Bartels
Greenhorn
Posts: 11
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the comments.
I'll check out the javadocs and see if I can't get a proper file name going somehow.
 
Paul Bartels
Greenhorn
Posts: 11
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fixed it by cropping the file name to everything after the last File.seperator.
Sorry for wasting everyone's time. ;)
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic