![]() |
Error In Uploading .rar and .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: Error In Uploading .rar and .pdf files (/showthread.php?tid=53464) |
Error In Uploading .rar and .pdf files - El Forum - 07-25-2012 [eluser]sazet_rey[/eluser] Hii Friends, I am creating a send mail application, so for attaching files to mails, i first need to upload the files to the server folder and then i need to attach them. my problem is that i am using a mutiple file upload application to first upload the files to the server folder. here's my uploading code foreach($_FILES['a_file']['tmp_name'] as $key=>$val) { echo $_FILES["a_file"]["type"][$key]; if(($_FILES["a_file"]["type"][$key] == "image/gif") || ($_FILES["a_file"]["type"][$key] == "image/png") || ($_FILES["a_file"]["type"][$key] == "image/GIF") || ($_FILES["a_file"]["type"][$key] == "image/PNG") || ($_FILES["a_file"]["type"][$key] == "image/jpeg") || ($_FILES["a_file"]["type"][$key] == "image/jpg") || ($_FILES["a_file"]["type"][$key] == "image/JPG") || ($_FILES["a_file"]["type"][$key] == "image/JPEG") || ($_FILES["a_file"]["type"][$key] == "image/pjpeg") || ($_FILES["a_file"]["type"][$key] == "text/plain") || ($_FILES["a_file"]["type"][$key] == "image/pjpeg") || ($_FILES["a_file"]["type"][$key] == "application/octet-stream") || ($_FILES["a_file"]["type"][$key] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document") || ($_FILES["a_file"]["type"][$key] == "application/msword") || ($_FILES["a_file"]["type"][$key] == "application/zip") || ($_FILES["a_file"]["type"][$key] == "application/rar") || ($_FILES["a_file"]["type"][$key] == "application/x-rar") ) { $file= 'attachment/'.md5(uniqid(rand())).$_FILES['a_file']['name'][$key]; $files="./".$file; move_uploaded_file($val,$files); $fullpath= base_url().$file; } else { echo "not uploaded"; } } My problem is that the application is working fine for other files like .zip, .jpg, .mpeg, etc. But its not working for the .pdf and .rar extension. I have even added these two lines to the mimes.php in config folder of the codeigniter, but still no luck. 'rar' => array('application/rar', 'application/x-rar', 'application/x-rar-compressed', 'application/x-compressed', 'application/octet-stream') 'pdf' => array('application/pdf', 'application/x-download') can anybody help me out of this problem. the error which displays when i try to upload .rar or .pdf files is given below A PHP Error was encountered Severity: Notice Message: Undefined index: a_file Filename: controllers/mail.php Line Number: 32 Error In Uploading .rar and .pdf files - El Forum - 07-25-2012 [eluser]LuckyFella73[/eluser] Quote: have even added these two lines to the mimes.php in config folder of the codeigniter, but still no luck. Doesn't make sense to edit config/mimes.php if you don't use the CI upload library for it's not involved in your upload process yet. Maybe try to use the CI library - there are examples around these forums how to loop through multiple files /upload them. Error In Uploading .rar and .pdf files - El Forum - 07-25-2012 [eluser]sazet_rey[/eluser] ok, i didnt use the upload library, in my code earlier, but later even after applying it, it doesnt get me any luck, still the same error while uploading, can anybody please help me having some concrete sp;utions?? |