0
我有一個圖片上傳腳本 在上傳表單頁面出現如下圖所示的輸入域:PHP腳本處理圖片上傳的 上傳圖像的腳本不能正常工作
部分是:
$path_parts = pathinfo($_FILES['product_image']['name']);
$imgext = $path_parts['extension'] ;
$imgextension = "." . $imgext ; //
// copying files to server
$target = "targetdomainpath/products/";
$target = $target . $_POST['product_name'].$imgextension;
//copying image
if(move_uploaded_file($_FILES['product_image']['tmp_name'], $target)) {
//Tells you if its all ok
echo "The file ". basename($_FILES['uploadedfile']['name']). " has been uploaded, and information has been modified inside the directory";
} else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file. or you didnt select photo from the computer";
}
// end image copying
我的問題是文件沒有上傳。你能幫我嗎
請您可以發佈您提交表單的HTML。你的錯誤信息是否也出現? – Luke
你的意思是你得到「對不起,有問題」或只是該文件不存在?你檢查文件夾是否存在並且擁有正確的權限?另外,'$ _FILES ['uploadedfile']'從哪裏來?肩上它是'$ _FILES ['product_image']'? –
作爲一點建設性的批評,請不要這樣評論你的代碼。你的意見沒有幫助,他們只是陳述每行代碼中已經陳述了什麼。你應該解釋爲什麼有些事情在做它做的事情,而不是它如何做。 – meagar