• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem uploading PDF Files

#1
[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
{
    function Post()
    {
        parent::Controller();
    }


    function product()
    {
        if(isset($_FILES['pdf']) AND strlen($_FILES['pdf']['name'])>0)
        {
            $pdf_path    = array('./pixs/products/pdf');
            $pdf_files    = array('pdf'); // FILE INPUT NAME
            $PDFUpload    = $this -> UploadPDF($pdf_path, $pdf_files)
        }
        
    }    

    function UploadPDF($upload_path=array(),$files=array())
    {
        $config['allowed_types']= 'pdf';
        $pdfPath[]        = array();
        $data[]            = array();
                        
        $count_files         = count($files);
                        
        for($i = 0; $i < $count_files; $i++)
        {
            $config['upload_path'] = $upload_path[$i];
            $this -> load -> library('upload',$config);

            if(isset($files[$i]) || is_array($files[$i]))
            {
                if(!$this -> upload -> do_upload($files[$i]))
                {
                    echo $this->upload->display_errors('<p>', '</p>');
                }
                else
                {
                        $data[$i]     = array('upload_data' => $this->upload->data());
                    $pdfPath[$i]     = $data[$i]['upload_data']['full_path'];
                                            
                    return $pdfPath;
                }
            }
        }
        return FALSE;
    }
}


Messages In This Thread
Problem uploading PDF Files - by El Forum - 01-31-2008, 02:21 AM
Problem uploading PDF Files - by El Forum - 01-31-2008, 02:33 AM
Problem uploading PDF Files - by El Forum - 01-31-2008, 02:41 AM
Problem uploading PDF Files - by El Forum - 01-31-2008, 02:56 AM
Problem uploading PDF Files - by El Forum - 01-31-2008, 02:59 AM
Problem uploading PDF Files - by El Forum - 04-10-2008, 10:41 PM
Problem uploading PDF Files - by El Forum - 05-13-2008, 11:00 AM
Problem uploading PDF Files - by El Forum - 07-15-2008, 09:53 AM
Problem uploading PDF Files - by El Forum - 08-14-2008, 10:59 PM
Problem uploading PDF Files - by El Forum - 08-21-2008, 11:29 AM
Problem uploading PDF Files - by El Forum - 04-21-2009, 08:17 AM
Problem uploading PDF Files - by El Forum - 08-11-2009, 10:40 AM
Problem uploading PDF Files - by El Forum - 10-10-2009, 08:28 PM
Problem uploading PDF Files - by El Forum - 10-10-2009, 08:33 PM
Problem uploading PDF Files - by El Forum - 10-12-2009, 01:19 PM
Problem uploading PDF Files - by El Forum - 10-12-2009, 02:08 PM
Problem uploading PDF Files - by El Forum - 11-13-2009, 05:07 PM
Problem uploading PDF Files - by El Forum - 12-09-2009, 03:32 AM
Problem uploading PDF Files - by El Forum - 01-08-2010, 06:03 AM
Problem uploading PDF Files - by El Forum - 01-08-2010, 07:07 AM
Problem uploading PDF Files - by El Forum - 01-08-2010, 07:36 AM
Problem uploading PDF Files - by El Forum - 01-08-2010, 07:55 AM
Problem uploading PDF Files - by El Forum - 02-02-2010, 03:15 PM
Problem uploading PDF Files - by El Forum - 02-02-2010, 04:32 PM
Problem uploading PDF Files - by El Forum - 04-25-2010, 04:19 AM
Problem uploading PDF Files - by El Forum - 04-25-2010, 06:42 AM
Problem uploading PDF Files - by El Forum - 04-28-2010, 09:55 AM
Problem uploading PDF Files - by El Forum - 07-27-2010, 09:28 AM
Problem uploading PDF Files - by El Forum - 01-24-2011, 03:38 AM
Problem uploading PDF Files - by El Forum - 01-24-2011, 10:34 AM
Problem uploading PDF Files - by El Forum - 07-20-2011, 02:39 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.