⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


How to validate the format of the image in image crud?

imagecrud upload format

  • Please log in to reply
4 replies to this topic

#1 J-c

J-c

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 15 January 2013 - 08:28 PM

Hello,

I use image crud and i want to upload image files (jpg, png, gif). But image crud allows me to upload anything (txt, mpeg...).
How can i get restrictions ?

I try to change the 'accept_file_types' in libraries/image_crud.php => 'accept_file_types' => '/.[gif|jpeg|jpg|png]$/i'
But it doesn't work. And the application/config/image_crud doesn't have a line like :
$config['image_crud_file_upload_allow_file_types']         = 'gif|jpeg|jpg|png';

Thanks for your help and sorry for my english

#2 J-c

J-c

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 16 January 2013 - 05:00 PM

nobody ? :(

#3 tlc033

tlc033

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 17 January 2013 - 10:52 AM

Hi J-c and welcome on GC.
Take a loock at class ImageUploadHandler on librarie/image_crud.php (~ line 552)
// The php.ini settings upload_max_filesize and post_max_size
        // take precedence over the following max_file_size setting:
                'max_file_size' => null,
                'min_file_size' => 1,
                'accept_file_types' => '/.+$/i',
                'max_number_of_files' => null,
Maby it can help you.

#4 J-c

J-c

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 18 January 2013 - 06:11 PM

Hi tlc033,
thank you for your answer!

I try everything but nothing works :

//'accept_file_types' => '/.[gif|jpeg|jpg|png]$/i',
//'accept_file_types' => 'gif|jpeg|jpg|png',
//'accepted_file_types' => '/(\\.|\\/)(gif|jpeg|jpg|png)$/i',
'accept_file_types' => 'png',

I don't know why.
is it works for you ?

#5 J-c

J-c

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 20 January 2013 - 07:34 PM

Corrected here by web-johnny : http://www.grocerycr...-vulnerability/





Also tagged with one or more of these keywords: imagecrud, upload, format

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users