CodeIgniter Forums
Upload problem when mixing images and PDF file - 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 problem when mixing images and PDF file (/showthread.php?tid=17968)



Upload problem when mixing images and PDF file - El Forum - 04-21-2009

[eluser]LuckyFella73[/eluser]
hi there,

I scripted a small backend where the user can upload 2 images
and a pdf file. Each file is checked/uploaded by a seperated
callback function.

The problem: I can upload 1 or 2 images OR the PDF file but not
all together. When selecting 1 or 2 images AND a PDF file
I get the error message "The filetype you are attempting to upload is not allowed".
In my tests I allways selected the same file (regarding to each input field).

Any ideas what could cause this problem?


Upload problem when mixing images and PDF file - El Forum - 04-21-2009

[eluser]LuckyFella73[/eluser]
In my first test I first called both image callback functions
and then the pdf callback function. When I call the pdf callback
function first, I get the same error message like mentioned before
just for the images and not for the pdf file anymore.
So I thinks that I have to reset the configuration in any way?
It doesn't seem to work to just set the config values in each
callback function.
Is there a way to reset the config values?


Upload problem when mixing images and PDF file - El Forum - 04-21-2009

[eluser]LuckyFella73[/eluser]
I got it to work now by overwriting the value this way:

Code:
$this->upload->set_allowed_types('pdf');

How would do you solve this? Is it bad praxis to use
more than one callback function? If yes: how to switch
between the different rules within one callback?


Upload problem when mixing images and PDF file - El Forum - 05-07-2009

[eluser]Josepzin[/eluser]
Related post: http://ellislab.com/forums/viewthread/113029/