0

I am getting this error: Could not open /home/Projectname/public_html/assets/uploads/empfiles/

The filetype you are attempting to upload is not allowed. for reading! File does not exist.

Please help me to resolve this.

I am using Codeigniter version:2.1.4 I have tried this solutions also, but no changes I found. Uploading in Codeigniter - The filetype you are attempting to upload is not allowed Code goes here:

$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(); 
}

Mime types for xlsx files 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel')

Advance thanks

Community
  • 1
  • 1
Preetham Rao
  • 69
  • 1
  • 2
  • 12

0 Answers0