fputs没有在服务器上写图像

$data = file_get_contents($url);
$image = config_item('temp_upload').$image_name;
$file = fopen($image, 'w+');
//fputs($file, $data);
file_put_contents($file, $data, FILE_BINARY);
fclose($file);

fputs and file_put_contents are not working. I created a sample php upload file with move_uploaded_file, and it works on the same uploading folder.

fopen($image,'w+') actually create the image with 0 byte.

I tried to change upload folder to 0777 nginx:nginx(nginx) apache:apache (php-fpm) nothing works. Same zero byte image.

Disable selinux. Still no use. I am getting any error for this.

Replaced move_uploaded_file to file_put_contents same problem. Is there anything to change in the php.ini? Searched and did not get any clue.

查看全部
doushang2023
doushang2023
2015/05/02 12:50
  • file-upload
  • nginx
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复