php - Reading RAW data from a Flash POST Request ( images ) -
I am interacting with a third party flash file to send an HTTP POST request to my server basically.
I know that I'm on the right path to some extent because it requires a crossdomain.xml
file, and before that I do not share anything in the post variable But since I have added that file 4 variables set up, these POST variables are sent to me by the application to give basic information about the file .. but I actually read the Raw post Data for f The need to save the image to be sent by As.
I know there are 3 ways ...
-
$ globals ['HTTP_RAW_POST_DATA']
-
$ HTTP_RAW_POST_DATA which is probably the same as
-
file_get_contents ('php: // input')
Also for the reason, neither by these "work" "work" I mean that they are not being set up, when I dump them, I do not get anything.
Could it be that there is a setting in php.ini
which I want to set or maybe the flash app is not actually sending the actual image? I think this is working right, because it is a semi popular API and it is used by some other sites, so I am pretty sure that it is okay at their end.
And they do not need any type of API key.
You can use HTTP_RAW_POST_DATA
Code> always_populate_raw_post_data = 1 will be required. Also, make sure you set upload_max_filesize
to a value that is too large for your files.
However, HTTP_RAW_POST_DATA will never work if POST data is being sent as Unless you are sending the file in a non-standard way, you actually receive Multipart / Form-Data , which is typically used when sending files goes.
$ _ FILES
to retrieve the upload. PHP automatically saves the file upload in a temporary location and places the location in the $ _ FILES
variable. You use the move_uploaded_file
function to move it to For example:
$ place_to_put_the_file = "/my_directory/image.jpg"; If (move_uploaded_file ($ _ FILES ['userfile'] ['tmp_name'], $ uploadfile)) {echo "file is valid, and was successfully uploaded. \ N"; } Else {echo "possible file attack attack! \ N"; }
Comments
Post a Comment