CodeIgniter Forums
pdf file type error in mozila firefox ?? - 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: pdf file type error in mozila firefox ?? (/showthread.php?tid=20590)



pdf file type error in mozila firefox ?? - El Forum - 07-15-2009

[eluser]Zeeshan Rasool[/eluser]
Hi all members,
here is a problem which is creating little problem, I have a page on which im uploading a pdf file in CMS. But uploading is working fine in IE but in firefox its giving error
"File type is not allowed"

Any idea?
i have mime.php like this

Code:
'pdf'    =>    array('application/pdf', 'application/x-download'),

and my model code is..
Code:
if($_FILES['pdffile']['size'])
{
  $pdffile    = 'pdffile';
  $config_pdf['upload_path'] = './directory/projects/;
  $config_pdf['allowed_types']     = 'pdf';
  $config_pdf['max_size']    = '50000';
  $this->upload->initialize($config_pdf);
  $this->load->library('upload', $config_pdf);
  if(!$this->upload->do_upload($pdffile))
  {
    $error         = $this->upload->display_errors();
   }
}
thanks in advance


pdf file type error in mozila firefox ?? - El Forum - 07-17-2009

[eluser]djenniex[/eluser]
I'm getting the same error. I'm using FF 3.5.1

I'm not sure, but I believe this is a problem this the content-type supplied by FF to the application and not CI. When I view the headers sent to my CI app, i'm getting

"application/pdf" <- with the quotes

In IE8, I get

application/pdf <- without the quotes

But if i'm uploading another type of document, IE. Word Document I get application/msword without the quotes.

This can be fixed by editing the mimeTypes.rdf file in your Mozilla profile folder and removing
Code:
<RDF:Description RDF:about="urn:mimetype:&quot;application/pdf&quot;"
                   NC:value="&quot;application/pdf&quot;"
                   NC:editable="true"
                   NC:fileExtensions="pdf"
                   NC:description="PDF Document">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:&quot;application/pdf&quot;"/>
</RDF:Description>
I will file a bug report with CI (even thought technically this is not a CI bug) to filter out these mime-types that are submitted.


pdf file type error in mozila firefox ?? - El Forum - 04-20-2011

[eluser]Thuong Tong Dinh[/eluser]
Dear,

In config/mimes.php:
change to 'pdf' => array('application/pdf', '\"application/pdf\"', 'application/x-download').

It's crazy but worked on firefox and IE Wink.