0

I try upload mxf file used codeigniter upload helper, but get 404 error when i try called, this is because the file no upload to server.

the file is name.MXF

$this->upload->display_errors() return

The filetype you are attempting to upload is not allowed.

this is strange, because in $config["allowed_types"] It is added the filetype

I can upload others type files in the same folder, therefore isn't a problem the permission or htaccess.

code example:

contoller

public function uploadFile(){
    $config["allowed_types"] = 'MxF|mxf|MXF';
    $folder= './uploads/';

    if (!file_exists($folder)) {
        mkdir($folder, 0777, true);
    }

    $config["upload_path"] = $folder;
    $this->load->library('upload', $config);
    $this->upload->initialize($config);
    $FileName="name";
    $this->upload->do_upload($FileName);

}

htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|assets|js|uploads|)
RewriteRule ^(.*) index.php?/$1 [QSA,L]

how i can upload this type files?

please help me!

SOLUTION

I found answer in this link and setting the "allowed_types" = '*' Codeigniter: The filetype you are attempting to upload is not allowed

  • first step is to read the how to ask section here on stack https://stackoverflow.com/help/how-to-ask and this https://stackoverflow.com/help/mcve. after doing so include your relevant code and reformat your question. 404 error can mean everything from an incorrectly configured htaccess to a form action that is posting to the wrong controller to an incorrectly set base_url. your code will help us debug this. – Alex Apr 30 '18 at 20:52
  • If you are getting a 404 error how are you getting the error: The filetype you are attempting to upload is not allowed. Doesn't make sense – Alex Apr 30 '18 at 22:45

1 Answers1

0

Try adding the following key/value pair to application/config/mimes.php

'mxf' => 'application/mxf',

Note the comma at the end of the above line. If you put this new line at the end of mimes.php (after 'ico' in my installation) be sure to add a comma to the previous line. After all, you are adding another entry into an array.

This addition should help the upload class set the header properly.

DFriend
  • 8,869
  • 1
  • 13
  • 26
  • thx!, maybe you answer work, because it's related. I found this link with the answer related my question and work. I setting the "allowed_types" = '*' https://stackoverflow.com/questions/43024959/codeigniter-the-filetype-you-are-attempting-to-upload-is-not-allowed?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Edo Barrios Garrido Apr 30 '18 at 22:51
  • * just allows everything. – Alex Apr 30 '18 at 23:08