File Upload and allowed type |
[eluser]satie[/eluser]
Hello, I know that there's a problem with the library Upload.php in ./system/libraries/ so I change the code using this guide: http://ellislab.com/forums/viewthread/204725/ But now CI sends me this error: Quote:Severity: Warning with this configuration in my controller: Code: $config['allowed_types'] = 'gif|jpg|png'; But if I use: Code: $config['allowed_types'] = '*'; There is no problem. I would like to avoid to upload all types. Thanks
[eluser]meer[/eluser]
What actually you wants to do ? please mention the prblem either u have problem with file upload type or some thing else...???
[eluser]satie[/eluser]
I'd like to use this configuration in my controller: Code: $config['allowed_types'] = 'gif|jpg|png'; But CI sends me the error.
[eluser]satie[/eluser]
Code: <?php
[eluser]meer[/eluser]
Try this in your controller $temp=preg_replace("/.*\.([^.]+)$/","\\1", $_FILES['your_image_field']['name']); $fileType=$_FILES['your_image_field']['type']; $config['allowed_types'] = $temp.'|'.$fileType;
[eluser]satie[/eluser]
Thanks for your answer. Your regular expression permits me to upload any kind of file. I'd like to upload only jpg|gif| But If I use this config Code: $config['allowed_types'] = 'gif|jpg|png|jpeg'; CI shows the error message: However the name of my file is simple and correct "Ninfee.jpg" :-( damn it! Thanks again.
[eluser]meer[/eluser]
i think am not understanding your problem properly i hope you will find out your solution soon:-)
[eluser]satie[/eluser]
Thanks. My english is not good. Sorry. The file upload works with this config: Code: $config['allowed_types'] = '*'; Doesn't work with: Code: $config['allowed_types'] = 'gif|jpg|png';
[eluser]meer[/eluser]
checkout this config arrays in your mime.php file @codeigniter/application/config/mime.php Code: 'jpeg' => array('image/jpeg', 'image/pjpeg'), if these are not there ,please add this in your mime.php |
Welcome Guest, Not a member yet? Register Sign In |