0

I am trying to upload tex files in my wordpress site. The methods I have tried and failed or the following. First of all the error I got is,

Sorry, this file type is not permitted for security reasons.

Tried Methods:

  • Method 1:

Added the below line in wp-config.php

define('ALLOW_UNFILTERED_UPLOADS', true);

Which did not work.

  • Method 2

Added the following codes which allows mime types in functions.php

// Adding Mime types 
function my_myme_types( $mime_types ) {
  $mime_types['svg'] = 'image/svg+xml';     // Adding .svg extension
  $mime_types['json'] = 'application/json'; // Adding .json extension
  $mime_types['tex'] = 'application/octet-stream'; // Adding .tex extension   
  return $mime_types;
}
add_filter( 'upload_mimes', 'my_myme_types');

which again did not help. I remember that only once the file got uploaded in local copy of the website which I dont know how?

  • Method 3

Added the plugin WP Add Mime Types, thinking that I can try adding the mime type. But It already shows me that 'appliations/x-tex' is already added from the method 2.

enter image description here

None of the above method helped me to upload the .tex files. Note that pdf files are getting uploaded without any issue.

PS: I am using a form to upload files. You may check here . Any suggestions would be really helpful.

1
  • Hopefully this can help
    – birgire
    Jan 31, 2019 at 7:17

1 Answer 1

0

Mime Type are not correct.

application/x-tex

enter image description here

Complete detail MimeType Source : https://www.lifewire.com/mime-types-by-content-type-3469108

1
  • Actually this did not work for me in the initial stage itself. Since, my file type shown that 'application/octet-stream', I have changed the tex file mime type to 'application/octet-stream'
    – gloom
    Jan 31, 2019 at 15:31

Your Answer

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

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