简体   繁体   中英

media add error wordpress

I am using wampserver64 windows7 OS

When I try to upload image via wordpress media library add new it shows error.

I tried to increase php memory by adding at wp-config.php

   define('WP_MEMORY_LIMIT', '256M');

But It did not help then I added below code at functions.php

  add_filter( 'wp_image_editors', 'change_graphic_lib' );
  function change_graphic_lib($array) {
   return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
 }

Again it did not help. then I add below code at .htaccess

  <IfModule mod_security.c>
   SecFilterEngine Off
   SecFilterScanPOST Off
  </IfModule>

Also it did not help. I changed at wordpress

   dashboard  settings>media> maximum file size width  2048 and height 2048 
   I tried to upload 1024x768 size image.

But nothing help.

Thanks in advance

1 .- PLUGINS trouble shooting:

You should have done this already there are plenty of posts in WP support… Disable all the plugins and re-enable them one by one until the uploader breaks. If disabling the plugins dont fix your uploader, Rename your Plugins folder and try to upload to see if that fixes it.

2 .- FUNCTIONS.PHP

Make sure you don't have any lines with comments in HTML mark up (Example ) Make sure you open and close the PHP tags ONLY ONCE!!! in the file. that fixed my uploader.

3.- JavaScript Problems

The reason there is not much support for this problem is because WordPress works, and the problem is coming from something you or your theme developer broke.

First Step: Chrome; go to the home page of your WordPress blog. Right click anywhere on the screen and on the menu that pops click on inspect element this will open a pseudo-window with information about your page source code etc…

In the bottom right of this window there is a cog (gear) icon and next to it a little red circle with a white x on it, next to that usually is a number (That lists parsing errors when your page loaded.

If you have any number next to the red circle click on it to see the detail of the error.

I've got this issue sometimes. Mostly with large MP3s. I've not found why there were an error. I think it's because of a malformed header in the file itself. Wordpress checks the header of file each time you upload it.

My answers :

1 : (NOT ADVISED ! RISKY AND UNSECURE AND I DON'T KNOW IF IT WORKS) You could (but shouldn't) try to remove mime types checking of uploaded files (in function.php). As it's insecure, If you want to test that you'll find how to do with google. Not by me :)

2 : The thing that works mostly everytime : Open your file and reencode (or save it) again with your editor/encoder. As I said, I had to reencode some MP3s I had (legal MP3s !) and after that, I could put the files on the server. Again, not really know why.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM