Php: // input failed to receive the file. The image is very small and cannot be opened. I use php: // input & nbsp; the code for receiving the image is as follows: $ file = & nbsp; file_get_contents ('php: // input'); & nbsp; $ this-& gt; filename = time php: // The input fails to receive the file, images become very small and cannot be opened
I use php: // input to receive the image code as follows:
$file= file_get_contents('php://input');
$this->filename=time().'.jpg';
$dirname .='Uploads'.DIRECTORY_SEPARATOR.'face'.DIRECTORY_SEPARATOR.'1';
$url=$dirname.DIRECTORY_SEPARATOR.$this->filename;
$handle=fopen($url, 'w');
fwrite($handle, $file);
fclose($handle);
The uploaded image is received in more than 70 kb and saved in more than 70 bytes. it cannot be opened at all. I use var_dump () to print the received data stream as follows: image%955e0caajw1dwnvnfmwk4j.jpg & submit = % E4 % B8 % 8A % E5 % 82% B3 % E6 % AA % 94% E6 % A1 % 88
Is that true? How can this problem be solved? Share The php data to: filename = time ()... 'data-pics = ''>
------ Solution --------------------
Reference:
Quote: reference:
Image%955e0caajw1dwnvnfmwk4j.jpg & submit = % E4 % B8 % 8A % E5 % 82% B3 % E6 % AA % 94% E6 % A1 % 88
Is the form control value
To upload images, use the $ _ FILES array.
Because the data stream of the uploaded file is intercepted by php, php: // input can only obtain values of other Form controls.
I want to receive images sent from the android client. android sends images in the form of file streams. Can $ _ FILES receive file streams?
Php: // input image data streams, which can only be used
File_put_contents ('images/1.jpg ', file_get_contents ("php: // input "));
Save
------ Solution --------------------
No, you will know about print_r ($ _ FILES!
Whatever the client is, what you get through php: // input is
Value named image control: 955e0caajw1dwnvnfmwk4j.jpg
Value for the submit control: % E4 % B8 % 8A % E5 % 82% B3 % E6 % AA % 94% E6 % A1 % 88 (in the above example)
There is no image data stream.