Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter: “The filetype you are attempting to upload is not allowed.”
#1

[eluser]CodeIgniterNewbie[/eluser]
I'm experiencing a very odd upload problem. Here's the relevant view file:

Code:
<form action="http://localhost/index.php/temp/upload/" method="post" enctype="multipart/form-data">
     <fieldset>
      &lt;input type="file" name="userfile"/&gt;
      &lt;input type="submit" value="Upload"/&gt;
     </fieldset>
    &lt;/form&gt;
And here's my `temp` controller's `upload()` method:

Code:
public function upload()
    {
     $config['upload_path']   = FCPATH . 'uploads' . DIRECTORY_SEPARATOR;
     assert(file_exists($config['upload_path']) === TRUE);
     $config['allowed_types'] = 'avi|mpg|mpeg|wmv|jpg';
     $config['max_size']      = '0';
    
     $this->load->library('upload', $config);
     if ($this->upload->do_upload('userfile') === FALSE)
     {
      // Some error occured
      var_dump($this->upload->display_errors('', ''));
      var_dump($_FILES);
     }
     else
     {
      // Upload successful
      var_dump($this->upload->data());
     }
    }

When I upload an AVI video, everything works fine. When I upload, say, a WMV video, I get the following var dumps:

Code:
string 'The filetype you are attempting to upload is not allowed.' (length=57)
    
    array
      'userfile' =>
        array
          'name' => string 'wmv.wmv' (length=7)
          'type' => string 'video/x-ms-wmv' (length=14)
          'tmp_name' => string 'C:\wamp\tmp\php2333.tmp' (length=23)
          'error' => int 0
          'size' => int 83914
The "wmv" extension is being interpreted as the MIME type: `video/x-ms-wmv`. This should be fine since my config/mimes.php has the following:

Code:
'wmv' =>  array('video/x-ms-wmv', 'audio/x-ms-wmv')

It's a similar situation when I try uploading other files. So far, the only one that seems to work is my test AVI video.

Any ideas what might be wrong?

UPDATE 1:

One my machine, only AVI uploads. On another developer's machine, no files upload. On yet another developer's machine, all supported files upload. Is this a browser or server issues?


Messages In This Thread
CodeIgniter: “The filetype you are attempting to upload is not allowed.” - by El Forum - 03-21-2012, 06:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB