Wordpress media library file Upload failure solution

Source: Internet
Author: User
Tags file upload ftp file

This is a problem with a previous win host user. Users in other systems do not know if this problem will occur. Generally, when the website directory has no 777 read/write permissions, the following message is displayed: the file cannot be moved to the directory!

A problem that occurs after the Windows host user upgrades to wordpress3.7.1:

After an image with a Chinese name is uploaded, the file name will appear in the directory where the FTP file is stored (wp-content/uploads/).Garbled. Direct access to the link does not display images. It seems to be a path problem. Otherwise, you can change the file name to a number or English and then upload the file. This indicates the problem.

How can we automatically rename the Chinese name to English or numbers? Of course, it cannot be modified manually. To facilitate management, we can modify the source file so that the system canAutomatically rename by year, month, or day.

Note: to modify the source file, remember to back up the previous file !!

Open the/wp-admin/shortdes/file. Php file.

Search:

$ New_file = $ uploads ['path']. "/$ filename ";

Replace:

$ New_file = $ uploads ['path']. "/". date_i18n ("YmdHis"). floor (microtime () * 1000). ".". $ ext;

Save and overwrite! The new file is automatically renamed in the format of "year, month, day, hour, minute, second, thousands of milliseconds integer ".

If you are too lazy to modify or are afraid of modification errors, you can directly download the modified source file and upload it to overwrite it!Load

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.