I am using a plugin custom contact form where i have kept a file upload field at the front end. But when i try to upload a pdf file then neither tmp_name nor type property of $_FILES is being set. However other files like jpg/gih are being uploaded.

Need urgent help

2 Answers 2


You should set your MIME types for your pdf. 'application/pdf' and/or 'application/x-pdf'

sorry for the quick answer, no time to go into detail but this should get you on the way

  • Mime types is set already. I saw that this issue occurs only if i try to upload very bulky file. However if i upload file having size less than or equal to the max upload file size then it works fine. Any help will be appreciated.
    – neeraj
    Oct 15, 2012 at 5:56
  • 1
    doesn't that answer your own question? make the max file size bigger? or catch it before you start uploading?
    – woony
    Jan 2, 2013 at 15:01
  • The issue was i had set size of 2MB but when i was trying to upload file of 2MB then still it was not being uploaded because file size (in Windows OS) remain different (less than) actual disk size of that file. So i increased the upload limit greater than 2MB and issue was fixed.
    – neeraj
    Jan 3, 2013 at 5:25
  • You should set your question as answered then
    – woony
    Jan 8, 2013 at 11:11

expand the list of available file types for upload

function add_pdf_mime_type($mimes) {

                        $mimes['pdf'] = 'application/pdf';

                        return $mimes;
add_filter('upload_mimes', 'add_pdf_mime_type');   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.