![]() |
Problem uploading PDF Files - 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: Problem uploading PDF Files (/showthread.php?tid=5676) |
Problem uploading PDF Files - El Forum - 01-31-2008 [eluser]sherpa[/eluser] Hi Everybody. I want to share my problem here. My problem is that i can't upload PDF files. I have created a function which meants to upload as many PDF files as i want passing file arrays and filepath arrays to the function as parameters. Everytime I try, it says The filetype you are attempting to upload is not allowed. However, i can upload JPG and GIF files with the same code changing extension without any errors. I don't know whats wrong with my following code. Hope you guys help me..; Code: class Post extends Controller Problem uploading PDF Files - El Forum - 01-31-2008 [eluser]xwero[/eluser] you should check what kind of file type that gets send along with the data Code: echo $_FILES['userfile']['type'] Problem uploading PDF Files - El Forum - 01-31-2008 [eluser]sherpa[/eluser] It returns application/pdf and its already in mimes.php. array('application/pdf', 'application/x-download') But it is still not working. Problem uploading PDF Files - El Forum - 01-31-2008 [eluser]xwero[/eluser] try this Code: function UploadPDF($upload_path=array(),$files=array()) Problem uploading PDF Files - El Forum - 01-31-2008 [eluser]sherpa[/eluser] Thanks a lot xwero It works perfectly now. Thanks a lot again. By the way wot was the problem XWERO?? Problem uploading PDF Files - El Forum - 04-10-2008 [eluser]Muppit[/eluser] I too had this problem - took me ages to find this post and when I did I followed the advice to check the file type being passed. Turns out it looked like this: 'aplication/unknown' - why I have no idea but explains why the uploader was spitting the dummy. Anyway, because it's 4:30pm Friday and because I'm dying for an ice-cold Steinlager I fixed the issue by amending this line: Code: 'pdf' => array('application/pdf', 'application/x-download'), Code: 'pdf' => array('application/pdf', 'application/x-download', 'application/unknown'), In the file located here: system/application/config/mimes.php I realise this is bad programming practices but like I said, it will band-aid that irritating error message until I can figure out why my PDF's are so crappy. Cheers, Muppit Problem uploading PDF Files - El Forum - 05-13-2008 [eluser]lay-z-cow[/eluser] Hi, is there any better solution than the one of Muppit? I have the same problem. My upload works perfect, but it won't let me upload pdf-files: "The filetype you are attempting to upload is not allowed." Even though it is. Same matter with docx and other office2007 files. Any ideas? Greets, Chris Problem uploading PDF Files - El Forum - 07-15-2008 [eluser]Unknown[/eluser] I had the same problem in FIREFOX 3.0 but not in IE 7.0 so my quick fix, since I was only uploading pdfs was to force Code: $_FILES['programa']['type']='application/pdf'; with that i had it working with both. BTW when I inspected Code: echo $_FILES['programa']['type'] it returned forcedownload or something like that Problem uploading PDF Files - El Forum - 08-14-2008 [eluser]Unknown[/eluser] Hi, I had the same when I was trying to upload PDF files from FireFox 2.0, I've fixed changing the 'pdf' array in config/mimes.php to: 'pdf' => array('application/pdf', 'application/x-download', 'application/force-download'), Perhaps there's variations in each browser, I tried in IE7, Safari 3 and FF2 (which was the only one who got the 'application/force-download' mime type). --Erik Problem uploading PDF Files - El Forum - 08-21-2008 [eluser]Unknown[/eluser] Hello everyone, I have been getting this message and reading what you all have done to fix it. The problem is that I am a true layman, as Sargent Schultz (Hogans Heroes TV show)would say "I know NOTHING!" however I am a great robot- I can follow exact directions if one of you can please tell me what to do step by step. I would be most grateful, Thanks |