Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5168
  • Last Modified:

Uploading files using multipart/form-data

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
Ratanesh
Asked:
Ratanesh
2 Solutions
 
msterjevCommented:
Go to:
http://examples.oreilly.com/jservlet2/

And search for MultipartRequest. This is a fully functional multipart parser which certanly works!
0
 
fargoCommented:
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
 
CleanupPingCommented:
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
 
jimmackCommented:
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
 
bcsinnovationsCommented:
please send me how to do an http post to sms/mms gateway for sending mms through pc using java.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now