Has anyone successfully posted MS files from a web page to a IS service to be saved onto the server’s disk drive? Here’s the scoop:
- build a web page that has a form with method=“POST”, action="/invoke/(someService)", and enctype=“multipart/form-data”. In this form have input variables and at least one input field with type=“file” (this lets the user specify a file to be uploaded by the user’s browser).
- the (someService) service accepts the MIME stream posted by the form and parses out the input variables (stored in a db) and the files (stored on the server’s disk drive) based on the MIME boundary definition.
- in another service, the server builds multipart MIME streams to be sent with the pub.client:smtp service with the file(s) read-in from the server’s disk attached and the variables specified included within the html body of the message. An expiration date can optionally be applied to the outgoing message.
So, I have step 1 and step 3 nailed, but step 2 is giving me problems. I can parse the variables, and I can parse the files, but MS word and MS Excel files appear slightly mangled. Text files and image files (GIF & JPG) work fine. It seems that sample.mime.helpers:streamToString may be altering the stream in some tiny way. Are the MS files different enough to confuse the streamToString service?
The MIME stream posted from the form (as opposed to being sent via e-mail) is different enough to cause the sample.mime:extract_MultipartMIME service to not detect the parts. The pub.flow:getTransportInfo looks okay, but I need to invoke the streamToSting service in order to separate the bodyparts using the boundary by hand, since the default content handler doesn’t split-up the MIME message correctly, as it does with the e-mail MIME, i.e., with e-mail it invokes the service for each body part individually.
Any clues would be appreciated…