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 images.

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 = iter.next();
    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: mgai...@hotmail.com
> To: user@commons.apache.org
> 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 files..pics, 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 filehttp://maven.apache.org/plugins/maven-jar-plugin/
> lets pickup this thread on us...@maven.apache.org
> HTH
> Martin-
> 
> 
> > From: thekonradz...@hotmail.com
> > To: user@commons.apache.org
> > 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!
> > 
> >                                       
>                                         
                                          

Reply via email to