• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Uploading a image

 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, supposing you have an HTML page (or jsp, or servlet)
with the code:

And supposing the file was an image(jpg or bmp or something else),
is it possible to get the SomeServlet servlet to store the image
in a folder, to be used later on in the web application?

Thanks for any help
 
Sheriff
Posts: 67682
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. Please see the JSP FAQ.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I found an example...



but I dont get it. I won't have a list of items, just one file,
from 1 INPUT tag. Is it necessary in this case to use the
org.apache.commons package, or can I store 1 file without it?

Thanks
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you can get it just by name?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The protocol supports multiple files in one upload. If you only have one it will still work just fine. I'd stick with the code as-is if it's working for you.

The Apache code is doing lots of tricky stuff for you. Browse the code or download Jason Hunter's MultiPartParser and see just how much. I wrote my own for a server that is not J2EE servlets, and it was a significant bit of work. For grins, also look at the Fitnesse server which does the same job in far fewer lines of code than any of those others.
[ March 17, 2006: Message edited by: Stan James ]
 
I child proofed my house but they still get in. Distract them with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic