commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <>
Subject RE: [fileupload] - Question about uploading additional files other than the ones in the form?
Date Sun, 07 Sep 2014 13:59:46 GMT
with no details provided nobody could understand question your scenario you changed the question
from how do I use fileupload  toHow do I use construct MIME multipart message containing non-ascii
jpg/gif/etc files

In the case of MimeMultipart messages you should be following this:
In an eventing system such as Apache HTTP Server Actions are the last step on a a form upload
thereforeYOU CANNOT CHANGE the contents of a submitted form when the Apache HTTP Server has
passed control via submit button to the predefined actionaction action="fup.cgi">
hiding the contents of action process function fup.cgi so that nobody can possibly understand
what the process is doing was not the nicest thing to do..
In short ANY predefined action <perl/php/java> can include additional files and thus
will be able to repack the contents so that by the time you call fileupload  the 'package'
will contain all the necessary files

If you are thinking of a servlet I would suggest using Tomcat but it seems you are using Apache
and not sharing who is handling .cgi extensions from Apache httpd.conf 

Its been a long week for me and I can tell by your testiness its been a long week for youBe
professional and you will get brief appropriate responses.
Provide no info and short testy insults to those who are trying to help you solve YOUR problem
and your situation will be exacerbated
Your choice

> From:
> To:
> Subject: RE: [fileupload] - Question about uploading additional files other than the
ones in the form?
> Date: Sat, 6 Sep 2014 15:29:12 -0400
> I'm not sure you understood my question correctly, because I have no idea what your answer
is supposed to be.
> Lets try this again.
> I have an web app that uses Apache Commons FileUpload to upload files.  I am using the
streaming api to stream files up, and then save them to my server.  This has nothing to do
with my war file, or application files, this has to do with user submitted files that they
themselves will be using on.
> I haven't exactly done the saving, but I know I can save it to my own filesystem, so
I don't think there should be much of a problem saving it to my server.
> What I am asking is this.
> The FileUpload uses a multipart form which is how the data is sent.
> <form method="POST" enctype="multipart/form-data" action="fup.cgi">
>   File to upload: <input type="file" name="upfile"><br/>
>   Notes about the file: <input type="text" name="note"><br/>
>   <br/>
>   <input type="submit" value="Press"> to upload the file!
> </form>
> With this I will select multiple files for upload.
> The issue is, I am upload a file, that contains additional data for files to be uploaded.
 Lets call this file A.  File A has to be read in order to upload additional files which are
> So when we look at this.
> // Check that we have a file upload request
> boolean isMultipart = ServletFileUpload.isMultipartContent(request);// Create a new file
upload handler
> ServletFileUpload upload = new ServletFileUpload();
> // Parse the request
> FileItemIterator iter = upload.getItemIterator(request);
> while (iter.hasNext()) {
>     FileItemStream item =;
>     String name = item.getFieldName();
>     InputStream stream = item.openStream();
> We see that the data for the file to be uploaded was sent over through a request.
> My question is basically I want to be able to add additional data to that request, but
I am not adding it myself.  Once I submit a file through the form, I want to be able to submit
more data, and how I do that is my question.  I want to know what exactly is FileUpload doing
to grab the images and parse them into the Input Stream?  What exactly is the multipart/data
form doing to make this happened, that is what I'm really looking for.  I will go look over
the SRC, but I figured I would ask here.
> As I mentioned before I have a few options that I thought of.
> 1.  Red the data mid stream, and then upload the file(how do I upload)?
> 2.  Save the file then upload.
> A.  Use a Servlet to fake a form and pass the data to itself?
> So again, user selects file, I read file, then select other files from their system that
are needed for the first file, and upload them all up at the same time.
> Thanks!
> > From:
> > To:
> > Subject: RE: [fileupload] - Question about uploading additional files other than
the ones in the form?
> > Date: Sat, 6 Sep 2014 11:44:46 -0400
> > 
> > Morning Konradthe <htp/file/ftp>uploader will need to have apriori knowledge
 of both:location of Main distro usually 'baseDir'
> > location of ancillary, classes, sources, html,css
> > 
> > This is the reason why you will never see an apache server provisioning individual
files(except for SVN/GIT) source ctl
> > 
> > package ALL files(resource/source/classes/README/doc/etc) up into a jar and drop
the jar into basedir and let your customers figure out how to untar/unzip/unjar the file
> > lets pickup this thread on
> > HTH
> > Martin-
> > 
> > 
> > > From:
> > > To:
> > > Subject: [fileupload] - Question about uploading additional files other than
the ones in the form?
> > > Date: Fri, 5 Sep 2014 20:05:03 -0400
> > > 
> > > Hello all,
> > > 
> > > I am basically uploading a file to my server, but within that file contains
path information to images that also need to be uploaded.  I am looking to read the file mid
stream and get the data for the images to upload.  It seems I am able to do this, but if this
is not possible will I be able save the file, read it, and then be able to get these images?
> > > 
> > > I am curious about how I will go about grabbing the additional files?  I see
that streaming works with InputStream from JavaIO as well as something from CommonsIO, so
I figured I could configure something to work with the fileupload stream.
> > > 
> > > I also thought that I could possibly try to create a form through my servlet
and pass the data through that, but I figured this would be the less favorable approach.
> > > 
> > > If anyone has any advice or thoughts I would appreciate it... Thanks!
> > > 
> > >  		 	   		  
> >  		 	   		  
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message