Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts FileUpload - Multipart data doesn't start with boundary

Candice Dow
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Struts 1.1 FileUpload to upload an image file. I specify enctype for the form as "multipart/form-data". The file item in the ActionForm is of type org.apache.struts.upload.FormFile. The form submits successfully. The FileUpload.isMultipartContent(request) flag returns true. I proceed to handle the request, using the Struts MultipartIterator like so:
MultipartIterator iterator = new MultipartIterator(request, bufferLength, contentLength);
A IOException is thrown : Multipart data doesn't start with boundary
I understand that in order to read the request it must find the boundary and looking at the way the MultipartIterator is implemented, it appears that it parses the content type string until it finds "boundary". When I write out the content-type, I get the following:
multipart/form-data; boundary=---------------------------7d33d7c37019a
So the content-type appears to contain a boundary. Has anyone encountered this problem before or have any suggestions?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic