• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload File Bug

#31
[eluser]Unknown[/eluser]
Friends this image size chk problem is solved by puting an external condition of is_image().
it will chk if there is an image then only chk image size otherwise skip.


if($this->is_image())
{
if (in_array($val, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
}
if (is_array($mime))
{
if (in_array($this->file_type, $mime, TRUE))
{
return TRUE;
}
}
else
{
if ($mime == $this->file_type)
{
return TRUE;
}
}

#32
[eluser]HarishKumar[/eluser]
Yes ,this is the right solution to upload pdf.
I have tested it.Actually in the first if it checks that the array elements and if one of the element is of image type then it jump into the inner loop and get the size of image,if the first if condition fails ,in your case of pdf then it not go into the inner loop..

#33
[eluser]DanielJay[/eluser]
[quote author="GreGre" date="1254274694"]I've noticed something funny here.
If I pass
Code:
$config['allowed_types'] = 'txt|pdf|doc|gif|jpg|png';
it works perfectly well
however if I put image extensions first
Code:
$config['allowed_types'] = 'gif|jpg|png|txt|pdf|doc';
only image file types get uploaded, others fail.[/quote]

I have also just found this in a project I am working on.

#34
[eluser]sanket[/eluser]
@ kofic : thanks ur code wrkd like a charm Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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