Codeigniter文件在服务器中上传错误

时间:2015-08-19 05:26:10

标签: php codeigniter

我收到此错误: 无法打开/ home / Projectname / public_html / assets / uploads / empfiles /

不允许您尝试上传的文件类型。 阅读!文件不存在。

请帮我解决这个问题。

我正在使用Codeigniter版本:2.1.4 我也试过这个解决方案,但没有发现任何变化。 Uploading in Codeigniter - The filetype you are attempting to upload is not allowed 代码在这里:

$filextesions  = $fileparameters->file_extensions;
$path          = $fileparameters->path_required;  
$filename      = $fileparameters->filename;
$inputfilename = $fileparameters->inputname;
$fileType      = $fileparameters->$inputfilename['type'];
if($fileparameters->width=='')
{
    $width = 0;
}
else
{
    $width = $fileparameters->width;
}
if($fileparameters->height=='')
{
    $height = 0;
}
else
{
    $height = $fileparameters->height;
}
/** Checking for file existence **/
$file_exist= FCPATH.'assets/uploads/'.$path.'/'.$filename;
if(file_exists($file_exist))
{
    /* Renaming the existed file name */
    $newfilename  = uniqid().$filename;
}else
{
    $newfilename = $filename;
}
/** Conifgure File parameters **/
$config['upload_path'] = FCPATH.'assets/uploads/'.$path;
$config['allowed_types'] = $filextesions;
$config['file_name'] = $newfilename;
$config['remove_spaces'] = FALSE ;
$config['max_size'] = '0';
$config['max_width']  = $width;
$config['max_height']  = $height;
/** Intialising uploadbject  **/
$this->upload->initialize($config);
/** Checking for File existence **/
if($this->upload->do_upload($inputfilename))
{
    return $newfilename;
}
else 
{
    return $this->upload->display_errors(); 
}

xlsx文件的Mime类型 'xlsx'=> array('application / vnd.openxmlformats-officedocument.spreadsheetml.sheet','application / zip','application / vnd.ms-excel')

提前谢谢

0 个答案:

没有答案