Get Image From Http Post With Php
Solution 1:
The error code "1" means that the image you tried to upload is too big. http://php.net/manual/en/features.file-upload.errors.php
Check your upload_max_filesize setting in php.ini.
I saw that your are trying to continue with $_FILES['media']['name'], but the actually uploaded file is available by the path given in $_FILES['media']['tmp_name'].
To be sure you handle your upload correctly refer to the php-docu: http://php.net/manual/en/features.file-upload.post-method.php
Solution 2:
First you must output the result of file_get_contents
(1), then you need to tell the browser that you're serving up an image instead of standard HTML (2).
echo file_get_contents('dummy.jpg'); // 1
header("Content-Type: image/jpg"); // 2
I just skimmed the surface for the header
function; you'll want to add a few more headers in a real-world case. Check out:
Solution 3:
Check the $_FILES array on the PHP side and see if your image is in there...
Do print_r($_FILES);
Post a Comment for "Get Image From Http Post With Php"