CI3.1.7 Upload Image Sometime Failed |
Hello,
I found some strange thing. I have two images, but I can only upload one of them. https://ibb.co/j1U0yb I can upload 456.jpg, but I can't upload 123.jpg (it will upload noimage.jpg instead) This is my controller's code PHP Code: $config['upload_path'] = './assets/images/event/'; Thank you very much in advance. (01-22-2018, 03:55 PM)forfunonly Wrote: Hello, Maybe this might help. I came across a situation where a file had the wrong extension - png instead of jpg. This was not obvious because the linux/window viewer showed the image as it should appear but didn't report it as being the wrong extension. the function getimagesize(...) gave the mime-type of this image as image/jpeg the public function "is_allowed_filetype($ignore_mime = FALSE)" at circa line 890 in system/libraries/upload checks the mime type for png ie image/png,image/x-png against the file_type which is set by getimagesize() and is therefore image/jpeg image/jpeg is not in the array of allowed image types image/png,image/x-png so it reported the file type as "not allowed" which gave the misleading impression that png files are not allowed. The result was upload->doupload returned false when trying to upload an image which, on the face of it, was valid. Bill |
Welcome Guest, Not a member yet? Register Sign In |