• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload filetype not allowed??

#21
[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.

#22
[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.

#23
[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
MojoMotor
PyroCMS
ExciteCMS
CodeFight (I think)

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

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

#25
[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.

#26
[eluser]Ossama Khayat[/eluser]
I see the fix is in 1.7.2 also Smile
http://bitbucket.org/ellislab/codeignite...7114bccbe1

#27
[eluser]Phil Sturgeon[/eluser]
[quote author="Ossama Khayat" date="1279163301"]I see the fix is in 1.7.2 also Smile
http://bitbucket.org/ellislab/codeignite...7114bccbe1[/quote]

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?

#28
[eluser]Ossama Khayat[/eluser]
Yes.

#29
[eluser]Sundance[/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:
Code:
$config['allowed_types'] = 'sql';
$config['max_size'] = '2048';
$this->load->library('upload', $config);

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

By debugging I could trace that /library/Upload.php::do_upload() returns FALSE at line 207ff:
Code:
// Is the file type allowed to be uploaded?
if ( ! $this->is_allowed_filetype())
{
   $this->set_error('upload_invalid_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,
Sundance

#30
[eluser]rainman[/eluser]
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.
Code:
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.

Code:
$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.



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.