PDA

View Full Version : How to convert multipart data in to form data from server to client



JDevloper
4 Jul 2013, 10:38 PM
Hi,

I am sending file with other form data's from client to server, using multipart/form-data, successfully
retrieved all the values, using multipart api's ,again am reading files from server and sending it to
client using multipart/form-data format..I have got my ajax response in mulltipart format.my requirement
is to convert this multiform format into normal form data and file...

What i suppose to do??

Looking for all you response....

Thanks,

tvanzoelen
5 Jul 2013, 5:26 AM
What do you want to do with the file data? You could change it into a base64 string ...

http://stackoverflow.com/questions/10982712/convert-binary-data-to-base64-with-javascript

JDevloper
5 Jul 2013, 8:07 AM
Hi ,

I didn't get your point,Can you please brief it,my purpose is just read the file from server and
showing it in to GUI.

Thanks,

tvanzoelen
5 Jul 2013, 10:41 AM
The way you want to do it is as far I know impossible. With html5 you could encode the data from your multipart response into a base64 string and display it, or otherwise to keep it client side to send it back to the server a later time.

For Html content or text it is possible to display it as innerhtml in a panel.

But other file types you must launch from your server. You could do that by adding an iframe to a panel and set the src to the the webservice which writes the binary data with the corresponding headers (mime-type) to the client.

To put it short, it is not possible to display files in the UI by getting it in a multi-part server response. First thing to know anyway, what kind of file types you want to display?

JDevloper
7 Jul 2013, 4:00 AM
Hi,

XSL and JS file formats

Thanks