aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse fileupload no longer works Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse fileupload no longer works" Watch "Eclipse fileupload no longer works" New topic
Author

Eclipse fileupload no longer works

Paul Bartels
Greenhorn

Joined: Jun 16, 2008
Posts: 11

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.


SCJP5 SCWCD
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

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.


JBoss In Action
Paul Bartels
Greenhorn

Joined: Jun 16, 2008
Posts: 11

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

Joined: Jun 16, 2008
Posts: 11

Fixed it by cropping the file name to everything after the last File.seperator.
Sorry for wasting everyone's time. ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse fileupload no longer works