raw-post

Reading RAW data from a Flash POST Request ( images )

孤街浪徒 提交于 2019-12-12 03:38:46
问题 I'm basically interacting with a third party API flash file to send HTTP POST requests to my server. I know I'm on somewhat the right path because it requires a crossdomain.xml file, and before I added that part nothing in the POST variables was showing up, however since I added that file there are 4 variables that are set, these POST variables are sent by the application to give me basic information about the file.. but I actually need to read the RAW POST data to actually save the image

Save raw_post_data to FileField using Django

人盡茶涼 提交于 2019-12-08 02:27:50
问题 I need to save some Raw Post Data (request.raw_post_data) straight to a FileField using Python/Django. All the information I have found so far is not helpful for saving RAW data. More specifically, the raw data is the wave data recorded from a Mic using Flash. Can someone please show me how this is done? Thanks! 回答1: Ok. I figured it out. You can use SimpleUploadedFile like this: if request.method == 'POST': from django.core.files.uploadedfile import SimpleUploadedFile object = Model.objects

Save raw_post_data to FileField using Django

孤街浪徒 提交于 2019-12-06 09:50:59
I need to save some Raw Post Data (request.raw_post_data) straight to a FileField using Python/Django. All the information I have found so far is not helpful for saving RAW data. More specifically, the raw data is the wave data recorded from a Mic using Flash. Can someone please show me how this is done? Thanks! Ok. I figured it out. You can use SimpleUploadedFile like this: if request.method == 'POST': from django.core.files.uploadedfile import SimpleUploadedFile object = Model.objects.get(pk=1) file_contents = SimpleUploadedFile("%s.mp3" % "myfile", request.raw_post_data, "audio/mp3") object

PHP CURL Using POST Raw JSON Data

巧了我就是萌 提交于 2019-11-29 08:14:09
I am working with PHP curl for post, for some reason I couldn't post the form successfully. $ch = curl_init(); $headers = [ 'x-api-key: XXXXXX', 'Content-Type: text/plain' ]; $postData = array ( 'data1: value1', 'data2: value2' ); curl_setopt($ch, CURLOPT_URL,"XXXXXX"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $server_output = curl_exec ($ch); When I try using the same in post it works, but not with PHP. var_dump($server_output) ==> string(67) ""require data1

PHP CURL Using POST Raw JSON Data

时间秒杀一切 提交于 2019-11-28 01:13:15
问题 I am working with PHP curl for post, for some reason I couldn't post the form successfully. $ch = curl_init(); $headers = [ 'x-api-key: XXXXXX', 'Content-Type: text/plain' ]; $postData = array ( 'data1: value1', 'data2: value2' ); curl_setopt($ch, CURLOPT_URL,"XXXXXX"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $server_output = curl_exec ($ch); When I try