![](/img/trans.png)
[英]cURL - prompt script works while same request with curl-php doesn't (Internal server error 500)
[英]Internal Server Error while processing the php curl code
我在PHP中有一個'curl'代碼
$ch = curl_init("http://www.abcd.in/upload.php");
curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => "@$file", "file_name" => "$file_name"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch);
curl_close($ch);
upload.php是作為
$file = $_FILES["file"]["tmp_name"];
$file_name = $_POST["file_name"];
$file_extension = substr(strrchr($file_name, '.') , 1);
$path = "uploads/".date("YmdHis", time()).uniqid().".$file_extension";
move_uploaded_file($file, $path);
執行此代碼后,盡管圖像已上傳,但出現內部服務器錯誤500。 我該如何克服?
CURLOPT_POST
。 嘗試查看apache日志錯誤並僅在安裝時進行驗證
sudo apt-get install curl php5-curl php5-xmlrpc
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.