Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
12-03-2012, 03:43 PM #1
- Join Date
- May 2009
- Thanked 0 Times in 0 Posts
I have a Flex app that I'm trying to add "file preview" functionality to. I have a LinkButton in Flex that, when clicked, should open the file in a new browser window. I found a helpful actionscript class that properly formats the POST data to pass the file to an HTML page. The files I want to preview are being stored in the database, and I'm passing the through the POST data as a ByteArray. The file POST data is put into a URLRequest, which is sent to the HTML page through a URLLoader.
Here's what my POST request looks like:
--lljcuqjclcnyicgrmwexayhafmkhiwfx Content-Disposition: form-data; name="Filename" arrows.png --lljcuqjclcnyicgrmwexayhafmkhiwfx Content-Disposition: form-data; name="Filedata"; filename="arrows.png" Content-Type: image/png ?PNG "image information as ByteArray" --lljcuqjclcnyicgrmwexayhafmkhiwfx Content-Disposition: form-data; name="Upload" Submit Query --lljcuqjclcnyicgrmwexayhafmkhiwfx--
12-03-2012, 08:36 PM #2
- Join Date
- Jun 2007
- Thanked 600 Times in 580 Posts
spit the data back as a base64 string and concat to build a data url to use as the .src of an iframe.
dataURLs are supposed to work in IE8, as long as the document isn't too big.PHP Code:
echo "data:" . $mimeType . ";" . $base64fileData ;
if you want 100% compatibility, you might just have to iframe the server response and give up on JS doing it for you.
Users who have thanked rnd me for this post: