我有一個函數,假設從POST請求中獲得圖像文件。我使用image_moo作爲外部庫在保存前調整圖像大小。用PHP使用Image_moo上傳文件
這裏是我的功能
$dest = $_SERVER['DOCUMENT_ROOT'] . '/refundstylesheet/uploads/images/' . $_FILES['upfile']['name'];
$temp_file = $_FILES['upfile']['tmp_name'];
$this->image_moo->load($temp_file)->resize(350,350)->save($dest, TRUE);
我沒有得到任何錯誤信息,它根本不保存在服務器上的圖像。
回聲$ DEST:** /var/www/html/refundstylesheet/uploads/images/image.png
回聲$ temp_file:**的/ tmp/phpFIQp6S
我做了所有必要的verifications與上傳文件和達到該功能。
'dest'應該是'$ dest' –
* 「我沒有得到任何錯誤消息」 * - https://ellislab.com/codeigniter/user-guide/general/errors.html --- HTTP: //php.net/manual/en/function.error-reporting.php –
這只是粘貼代碼時的一個錯誤。但在我的原始源代碼是正確的。 – Wellyngton