Upload File Bug |
[eluser]Josepzin[/eluser]
Fix of my code, the previous version dont work with extension in uppercase and dont work with extension with size greater or less of 3 chars... example .JPEG or .7z THis is the correct code: Code: // example
[eluser]adamp1[/eluser]
Is there any official CI response on this bug? Anyone?
[eluser]tottyandbaty[/eluser]
[quote author="Dregond Rahl" date="1242848529"]i'v been testing this class a bit and i think this would solve the first problem Code: if (in_array($val, $image_types) && $this->is_image()) And for the PDF problem returning "application/octet" do you have Adobe acrobat reader on your comp? iv noticed it only returns an error for this if the application for that file isn't there. =/[/quote] Very good!
[eluser]tottyandbaty[/eluser]
about pdf files IE: Array ( [name] => DS3323019-1c_FTM-3001C-SL15G.pdf [type] => application/pdf [tmp_name] => C:\WINDOWS\Temp\php105.tmp [error] => 0 [size] => 251959 ) FF: Array ( [name] => DS3323019-1c_FTM-3001C-SL15G.pdf [type] => application/octet-stream [tmp_name] => C:\WINDOWS\TEMP\phpA9C.tmp [error] => 0 [size] => 251959 )
[eluser]Unknown[/eluser]
quoting Hendrix from http://codeigniter.com/bug_tracker/bug/7291/: "Temp fix: Reverse the list of allowed_types and put image (|gif|jpg|png) at the end of the string." This worked for me anyways. Matt
[eluser]Unknown[/eluser]
I was such a settlement! Questions is file type! mimes.php Code: $mime = $this->mimes_types(strtolower($val)); Array ( [0] => audio/wav [1] => audio/x-wav ) upfile.php Code: print_r($_FILES); Array ( [files] => Array ( [name] => S.H.E.mp3 [type] => audio/mpeg [tmp_name] => D:\Temp Files\php1CFF.tmp [error] => 0 [size] => 1862711 ) ) $_FILES[files][type] != $mime So it can not upload!
[eluser]mcnux[/eluser]
I've just gone through the is_allowed_filetype method and have come up with the following to fix the mixing images with other file types bug. Essentially it first checks that the mime type matches before checking for valid image, which is what the function should have been doing in the first place - you don't want to check that the image is valid before you know that you have an image! Had a quick test and appears to be fine. Also a few lines less than the original ;-) Code: function is_allowed_filetype()
[eluser]gscharlemann[/eluser]
I've tried several different approaches with this, both rewriting the is_allowed_filetype() function as shown above and Code: // example Both seem to work in IE and Safari, but Firefox throws the "The filetype you are attempting to upload is not allowed." error. Is anyone else experiencing this?
[eluser][At!][/eluser]
My quick bug fix entails add an additional mime type. When I check what Code: $_FILES['userfile'] I saw "type" part was escaped Code: $_FILES['userfile']['type'] => \"application/pdf\" I don't know why the it's escaped, but my bug fix was to include the escaped string to the mime type array Code: 'pdf' => array('\"application/pdf\"' ,'application/pdf', 'application/x-download', 'application/download') Hope it helps some one. At the moment I can't sit and do a proper fix so the about does the job for me.
[eluser]GreGre[/eluser]
I've noticed something funny here. If I pass Code: $config['allowed_types'] = 'txt|pdf|doc|gif|jpg|png'; however if I put image extensions first Code: $config['allowed_types'] = 'gif|jpg|png|txt|pdf|doc'; |
Welcome Guest, Not a member yet? Register Sign In |