aspose file tools*
The moose likes I/O and Streams and the fly likes Uploading image and thumbnail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Uploading image and thumbnail" Watch "Uploading image and thumbnail" New topic
Author

Uploading image and thumbnail

Tristan Van Poucke
Ranch Hand

Joined: Jun 30, 2008
Posts: 47
I created an applet that upload's images using commons.fileUpload.
That worked perfectly but now I wanted to upload a thumbnail of that picture at the sametime, that would be called thumb_picturename.jpg on the server.
the resizing works but I'm having a problem with renaming the files.


All this seems todo is change the original file on my harddisk in size and by name.
I'm probably going to need some kind of buffer to do this.

Can anyone point me in the right direction please?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

You didn't show us resizeImage(), so we can't tell what it does, but yes, this line:

will rename whatever on-disk file thumbnail represents to whatever the name of thumbnailren is.
Just in case you don't know, let me point out that File objects don't necessarily represent an on-disk file (hence the exists() method). If you want two files on-disk, you will have to write out data twice.
[ September 02, 2008: Message edited by: Joe Ess ]

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Tristan Van Poucke
Ranch Hand

Joined: Jun 30, 2008
Posts: 47
Yes but I want to take one file from users disk and put two files with different sizes on the server, without changing anything on the users disk.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

So don't invoke renameTo().
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uploading image and thumbnail