-4
public function upload($file = array(), $where)
{
if (file_exists($this->src.$file['name']))
{
$data['error'] = "Sorry, file already exists.";
}
elseif ($file["name"]["size"] > 500000) {
$data['error'] = "Sorry, your file is too large.";
}
elseif(is_array($file))
{
if(in_array($file['type'], $this->type))
{
$filePath = $this->src.$file['name'];
$file_Check = move_uploaded_file($file['name']['tmp_name'], $filePath);
if ($file_Check)
{
print_r($file); die();
$name = $file['name'];
//$this->update(array('photo'=>$name,'candi_id'=>$where));
}
$data['error'] = 'File has been uploaded';
}
else
{
$data['error'] = 'File formet was not supported';
}
}
else
{
$data['error'] = 'No File was uploaded...';
}
return $data;
}
文件路徑顯示正確。函數也工作正常,但文件不移動到文件夾?
您檢查您的文件夾的權限? – Dharmendra
考慮fomatting。這是不可讀的。 – abksrv
得到這個正確的? '$ filePath' ??哪個錯誤'$ data ['error']'你會得到什麼? – devpro