0
我試圖在php中上傳文件,但我無法做到這一點。我收到成功消息,我的記錄也保存在數據庫中,但是我的文件夾不包含上傳的文件。圖像文件夾是空的。無法上傳PHP中的文件
請幫忙。
我的HTML代碼:
if($_FILES['site_logo']['name'] != ''){
$uploaded_file = $_FILES['site_logo']['name'];
$exp = explode(".",$uploaded_file);
$extension = end($exp);
$allowed_types = array('jpg',"jpeg","png","gif");
if(in_array($extension,$allowed_types)){
$path = "images/".$uploaded_file;
if(move_uploaded_file($_FILES['site_logo']['tmp_name'],$path))
{
$_SESSION['upload_success'] = "File Uploaded succesfully";
}
else
{
$_SESSION['upload_error'] = "Something went wrong, file cannot be uploaded";
}
}
else
{
$_SESSION['upload_warning'] = "Please upload appropriate file type";
}
}
else
{
$_SESSION['upload_warning'] = "Please upload file";
}
支票影像文件夾的權限 –
你有ENCTYPE =「多/表單數據「?也作爲vikas說,檢查目錄權限 – Auris
可能重複的[PHP文件上傳問題](http://stackoverflow.com/questions/9424516/php-file-upload-issues) –