$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>wp filesystem - How to upload .tex files in wordpress?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

wp filesystem - How to upload .tex files in wordpress?

matteradmin9PV0评论

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.

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.

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.

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.

Share Improve this question asked Jan 31, 2019 at 6:55 gloomgloom 1851 gold badge3 silver badges12 bronze badges 1
  • Hopefully this can help – birgire Commented Jan 31, 2019 at 7:17
Add a comment  | 

1 Answer 1

Reset to default 0

Mime Type are not correct.

application/x-tex

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

Post a comment

comment list (0)

  1. No comments so far