Welcome Guest, Not a member yet? Register   Sign In
Upload filetype not allowed??

[eluser]Phil Sturgeon[/eluser]
[quote author="Ossama Khayat" date="1279121670"]I suffered trying to fix this, and after some debugging I found the solution, which is what in the patch for 2.0.
Why isn't this also fixed for 1.7.2?[/quote]

There are lots of things fixed in 2.0 that aren't fixed in 1.7.2. If everything from 2.0 went into 1.7.2, we wouldn't have a 2.0 now would we! :-)

You can use the 2.0 Upload.php in 1.7.2 without any problems, so download and use.

[eluser]Ossama Khayat[/eluser]
You're right Smile But maybe at least release 1.7.3 or a maintenance release till we have 2.0 ready.
This is a bug, and not a new feature, so IMHO it should be fixed.

[eluser]Phil Sturgeon[/eluser]
If you need the new changes use 2.0. There are 5 large CMS systems running on it already and none of them are struggling too much.

ExpressionEngine 2.0
CodeFight (I think)

If they are all using it, I'm sure you'll be fine.

[eluser]Ossama Khayat[/eluser]
Now we're talking Big Grin I'll use it.
Is the user guide 2.0 documentation enough for upgrading?

[eluser]Phil Sturgeon[/eluser]
Take a look. 2.0 is not a massive difference from 1.7.2, just lots of bugs fixed and a few cool new features. The cool new features are not 100% finished or documented but who cares.

[eluser]Ossama Khayat[/eluser]
I see the fix is in 1.7.2 also Smile

[eluser]Phil Sturgeon[/eluser]
[quote author="Ossama Khayat" date="1279163301"]I see the fix is in 1.7.2 also Smile

Only since the security patch the other day. The security issue was patched in 2.0 and the library was copied across. Is this conversation over yet?

[eluser]Ossama Khayat[/eluser]

Hi guys,
I have a similar issue even though I am already using 2.1.2. The problem is that the upload works fine locally using Xampp but not remote on my hoster's server.

I am trying to upload an sql file. My initialization is:
$config['allowed_types'] = 'sql';
$config['max_size'] = '2048';
$this->load->library('upload', $config);

My mime type is setup like this:
'sql' => array('text/x-sql', 'application/octet-stream')

By debugging I could trace that /library/Upload.php::do_upload() returns FALSE at line 207ff:
// Is the file type allowed to be uploaded?
if ( ! $this->is_allowed_filetype())
   return FALSE;

$ext and $mime contain the correct values in the function is_allowed_filetype(). And as I said, it works locally with Xampp 1.7.7 with PHP 5.3.8 while my hoster is running PHP 5.2.17.

Any ideas on this one?

Best regards,

Do you have the proper rights on the hosted server for the tmp and upload file location?

In my case, I wasn't able to read the file in the tmp_location so the is_allowed_filetype was returning FALSE.

Since allowing (*) was a poor option, I adjusted the code slightly to ensure that I could still use the class. I'll have to go back and adjust a little more but, it works for me while testing in dev / production.
In the following function >> public function is_allowed_filetype
Here is the code snippet.
if (is_array($mime))
   // updated this to check mime defined vs. file_type for now.
   if (in_array($this->file_type, $mime, TRUE))
    return TRUE;
   if (in_array($ext, $mime, TRUE)) {
    return TRUE;

** In my case I was uploading a csv file. I updated my mimes array to include csv as part of the csv array. I'm going to go back and update this to if(array_key_exists) in the code above to tighten it up a bit.

$mimes = array( 'hqx' => 'application/mac-binhex40',
    'cpt' => 'application/mac-compactpro',
    'csv' => array('csv', 'text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),

In your case with uploading a sql script, this may and may not work for you... but, just in case.. figured it might help someone.

Theme © iAndrew 2016 - Forum software by © MyBB