Welcome Guest, Not a member yet? Register   Sign In
Problems with CI file upload controller and Flex (FileReference class)
#7

[eluser]log2e[/eluser]
The file upload works now, but the downside is that the "image_width" and "image_height" properties are empty. I took a look at the "Upload.php" library. The function set_image_properties() depends on the is_image() function, and the is_image() function depends on the correct mime type.

CI's upload library tries to detect the mime type by these two lines:

Code:
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
$this->file_type = strtolower($this->file_type);

According to the PHP documentation "$_FILES['userfile']['type']" is a piece of information that comes from the browser (PHP itself does nothing to verify this information).

The only workaround I can think of is to write a function that derives the MIME type from the file extension instead, and then to use the PHP functions exif_imagetype() and getimagesize() for further validation and getting the width and height of the image.


Messages In This Thread
Problems with CI file upload controller and Flex (FileReference class) - by El Forum - 05-04-2008, 02:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB