• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to allow .php file uploads

I am using codigniters built in file upload library, and I want to allow php files to be uploaded.

This facility is only available to admin users behind a secure login etc.

But for some reason, I am getting 'The filetype you are attempting to upload is not allowed' errors.

I have this in my controller:
$config['allowed_types'] = 'pdf|doc|docx|php';

And I also have this line in config/mimes.php:
'php'   =>  'application/x-httpd-php',

This actualy functionality works if i try to upload an image file etc, so it is working, just not allowing .php files.

Any ideas why this doesnt work? Am i missing something?

The whole point of type-restricting uploads is to prevent this ...

You can probably get it working by debugging the mime type that CodeIgniter is comparing to your allowed file types.

Like Narf is saying, uploading PHP files is bad. Probably the worst thing you could upload, unless you're uploading them to an environment that doesn't serve/run PHP files.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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