• 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

Uploading image and thumbnail

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So don't invoke renameTo().
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic