This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Apache File Upload - which JAR is required?

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone tried Apache File Upload, which JAR file needs to be taken into classpath? I couldn't find that on site

Thanks.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The download only has a single jar files that contains classes. The other two files contain the source and the javadocs, as their names imply.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
The download only has a single jar files that contains classes. The other two files contain the source and the javadocs, as their names imply.



I downloaded 'commons-fileupload-1.2-src.zip' file and it doesn't contain any JAR file.

Is that the same one you took?
[ February 23, 2007: Message edited by: ankur rathi ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The src in src.zip stands for source code.
Download the one that doesn't have src in the name.
That one will contain the needed jar file.

Moving to Other Open Source APIs.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks both of you.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now I am stuck at this place and finding no suggestion on net.

This is my HTML page:



And this is servlet code:



Now my two problems are:

1. isMultipart is always true because I have added 'enctype' attribute in the form, before it was always false. I suppose it should be decided on the basis of data not on the basis of this attribute.

2. items list has no item always. But I am supplying data in both the input fields.

Please help. Thanks.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you need an id for your form fields.


Also, did you grab the 2 required jars(fileupload.jar and the io jar)?
HTH!
[ February 23, 2007: Message edited by: g forte ]
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by g forte:
I think you need an id for your form fields.



It worked. Thanks G.

Is following the right way to implement upload functionality:

I am able to get the file name and file content at server side. Now with some string operations I get the extension then based on the extension I choose the image (icon of doc, ppt, txt, pdf etc) to display to user and I set href to the same kind of file that has the content which I just got, and that is called when clicked on that image.

Hope that is clear.

Is there any better way?

Thanks.
 
g forte
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds good, unless you need to offer this file(the one just uploaded) to other users to download. In that case, I would change the mime type to
response.setContentType("application/x-download");
Which would force the download dialog as opposed to opening it up in the browser.
HTH
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic