CodeIgniter Forums
Upload File Bug - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Upload File Bug (/showthread.php?tid=18232)

Pages: 1 2 3 4


Upload File Bug - El Forum - 10-01-2009

[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;
}
}


Upload File Bug - El Forum - 10-01-2009

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


Upload File Bug - El Forum - 10-22-2009

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


Upload File Bug - El Forum - 07-11-2011

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