uploading an image with file_put_contents makes 0 byte file.
here is the code that I use. I extract facebook image url and put it into the web server.
$fb_image_url = 'https://example.com/229282.jpg'
$filename = substr($fb_image_url, strrpos($fb_image_url, '/') + 1);
file_put_contents('upload/user_pic/original/'.$filename, file_get_contents($fb_image_url));
after I do this, the server receives the file name successfully, but it is 0 bytes.
I checked php.ini, and allow_url_fopen is ON.
uploading folder permission is also fine.