?
Solved

Uploading files using multipart/form-data

Posted on 2003-03-27
6
Medium Priority
?
5,149 Views
Last Modified: 2012-05-04
I want to upload files usign a servlet through multipart/form-data. I have written code which gets the input stream and parses the top headers till the actual file contents starts and then the boundary header at the bottom. i also get the file name from the header which i am using it to store the file to the server. I am able to upload a txt file and bmp file and .java and .class files but .gif and .jpg files are not uploaded as it should be. when i upload gif or jpg file and open it both opens but the images are incompleted and blurred respectively there is no error shown when i try to open these files. When i upload a Pdf files it uploads but the pages are blank. when i upload the pdf files without parsing the contents i.e., i read the whole inputstream as byte and writting the whole stream as byte then the file is uploaded perfectly. I know there are ready codes available but i want to write one of my own. If some body can tell me what is going wrong it will be a great help for me. corrently i am reading and writting in bytes or if i could get the logic to parse the content with out disturbing the bytes so that i can upload any file perfectly i will be amazing...Thanks.
0
Comment
Question by:Ratanesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Accepted Solution

by:
msterjev earned 100 total points
ID: 8216257
Go to:
http://examples.oreilly.com/jservlet2/

And search for MultipartRequest. This is a fully functional multipart parser which certanly works!
0
 
LVL 11

Assisted Solution

by:fargo
fargo earned 100 total points
ID: 8219660
Hii,

Take a look at jspsmartupload

http://www.jspsmart.com/

This is also a very good upload tool and having some sample codes on the site. It's a freeware.

If you have further questions, ask back.
thanks and regards
happy working
fargo
0
 

Expert Comment

by:CleanupPing
ID: 9058461
Ratanesh:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9734739
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between mstrjev and fargo.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0
 

Expert Comment

by:bcsinnovations
ID: 11849105
please send me how to do an http post to sms/mms gateway for sending mms through pc using java.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question