Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > binary file upload from a form to a byte[]

Reply
Thread Tools

binary file upload from a form to a byte[]

 
 
Sigi
Guest
Posts: n/a
 
      01-11-2007
I'm developing a web application which has to receive binary files uploaded
by users through a form.

This is the form (which is inside a JSP):
<form method="post" action="MyServlet" enctype="multipart/form-data"
id="upform">
<p><input name="fileupload" size="30" id="fileupload" type="file"></p>
<p><input id="button" style="width: 135px;" value="Invia" type="submit"></p>
</form>

In the servlet MyServlet, I need to write in the doPost method some code to
receive the file from HTTP POST and store it into a byte array (without
saving the file on disk)

How can I do?

Thanks.


 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      01-11-2007
Sigi wrote:
> I'm developing a web application which has to receive binary files uploaded
> by users through a form.
>
> This is the form (which is inside a JSP):
> <form method="post" action="MyServlet" enctype="multipart/form-data"
> id="upform">
> <p><input name="fileupload" size="30" id="fileupload" type="file"></p>
> <p><input id="button" style="width: 135px;" value="Invia" type="submit"></p>
> </form>
>
> In the servlet MyServlet, I need to write in the doPost method some code to
> receive the file from HTTP POST and store it into a byte array (without
> saving the file on disk)
>
> How can I do?
>
> Thanks.


You can look at FileUpload API from Apache - specifically, the
ServletUpload package.
http://jakarta.apache.org/commons/fi...e-summary.html.
You do not need to write files on the disk to manipulate them. I
believe that is what you need.

-cheers,
Manish

 
Reply With Quote
 
 
 
 
Sigi
Guest
Posts: n/a
 
      01-12-2007
Manish Pandit wrote:
> You can look at FileUpload API from Apache - specifically, the
> ServletUpload package.

It works perfectly.

Thanks!
SigiTM


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML File Upload using enctype=multipart/form-data in form? Matt Java 8 05-26-2012 07:40 AM
File upload from client application (non-form based upload) stuart@microsoft.com Python 1 11-25-2006 12:14 AM
Upload a file without file Upload control - ASP.Net =?Utf-8?B?U2FyYXY=?= ASP .Net 3 08-03-2005 01:09 AM
HTML File Upload using enctype=multipart/form-data in form? Matt HTML 1 10-12-2004 08:17 PM
How to detect sizeof upload in order to show status of browser file upload? Heather Fraser Java 0 07-05-2004 12:35 AM



Advertisments