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

[eluser]Unknown[/eluser]
[quote author="thisischris" date="1332668939"]I have also recently gotten that error. I think someone forget to select a file and hit upload anyway. Now each time it gives me the error.

I found this in the log: ERROR - 2012-03-25 11:22:36 --> Severity: Notice --> Undefined index: tmp_path /homepages/14/xxxx/htdocs/xxx/system/libraries/Upload.php 1058

which is this block: [codeif (DIRECTORY_SEPARATOR !== '\\' && function_exists('exec'))
{
$output = array();
@exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code);
if ($return_code === 0 && strlen($output[0]) > 0) // A return status code != 0 would mean failed execution
{
$this->file_type = rtrim($output[0]);
return;
}
}[/code]

This line basically: @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code);

It works perfectly in my localhost (windows) however the server is definitely linux.[/quote]

I ran across the same problem on my Mac. I print_r()'d $file and found that there was no 'tmp_path' element in that array, only 'tmp_file'. I replaced 'tmp_path' with 'tmp_file' and it worked.

Maybe Windows uses 'tmp_file' and Linux/Unix use 'tmp_path'? To get it to work on both Windows and Linux, you may need to write some code that checks for both 'tmp_file' and 'tmp_path' and uses whichever one is there.

I'm new to CodeIgniter--does anyone know how I can report this as a possible bug?


Messages In This Thread
CodeIgniter: “The filetype you are attempting to upload is not allowed.” - by El Forum - 04-03-2012, 09:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB