Get file from HTTP POST (upload image)

Advertisement
Hello,
I would like to integrate http://www.plupload.com flash component to my APEX 4.1 website. I need it because I want to resize image and transform image before upload on client side, upload multiple files etc..
But I don't know how to read image binary data from POST method.
When I hit "Start upload" button on plupload component it makes some transformations and creates POST method like this:
------pluploadboundary1334433145869
Content-Disposition: form-data; name="name"
p16qp6jm3nhan1ca46me1ocr3tu1.jpg
------pluploadboundary1334433145869
Content-Disposition: form-data; name="chunks"
1
------pluploadboundary1334433145869
Content-Disposition: form-data; name="chunk" 0
------pluploadboundary1334433145869
Content-Disposition: form-data; name="file"; filename="centerd.jpg"
Content-Type: image/jpeg
ÿØÿà�JFIF������ÿÛ�„�
image content
   now I would like to read content of this HTTP POST and read sended image and store it to DB.
Question is... how can I read file sended with HTTP POST in APEX pl/sql process or pl/sql procedure?
Thank you...
Edited by: cardel on Apr 14, 2012 11:17 PM
Advertisement

Replay

Hi,
here are my two cents ...
this will be a bit difficult. When you use the standard APEX File upload it is not PL/SQL handling the POST request. The request is handled by the webserver - depending on the variant you are using it is either mod_plsql, the C code of the Embedded Gateway or the APEX Listener. The webserver is also doint the insert into APEX' file repository. So I see two options:
It might be possible to configure your plugin (don't know about it) the behave the same as a standard browser upload. Then for APEX there would be no difference - mod_plsql should handle the files accordingly.
If you want to handle the POST request yourself, as said, you can't do this in PL/SQL. It would be possible to write a Java servlet doing this and deploy that servlet on the same container as the APEX Listener (when using Apache with mod_plsql you would need an additional Java server for that) ....
Hope this helps ...
Best regards
-Carsten