最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Failed media upload: "The uploaded file was only partially uploaded."

programmeradmin2浏览0评论

I am running Linux CentOS 5.8 and I have my web pages using WordPress 4.0.

I am trying to uplad jpg photos to server via WordPress, but it randomly fails. I uploaded few photos, and then I get errors like:

“4.JPG” has failed to upload due to an error
The uploaded file was only partially uploaded.

Then I try again and again and again until it is successfuly uploaded. Very frustrating.

How can I debug this? Is there a log file? Where to look for?

I am running Linux CentOS 5.8 and I have my web pages using WordPress 4.0.

I am trying to uplad jpg photos to server via WordPress, but it randomly fails. I uploaded few photos, and then I get errors like:

“4.JPG” has failed to upload due to an error
The uploaded file was only partially uploaded.

Then I try again and again and again until it is successfuly uploaded. Very frustrating.

How can I debug this? Is there a log file? Where to look for?

Share Improve this question asked Jan 29, 2015 at 13:56 DanijelDanijel 1551 silver badge8 bronze badges 3
  • 1 Can you add more info on what webserver this is running on? Does this only happen with big files? – kraftner Commented Jan 29, 2015 at 14:07
  • 1 Files are only 100 kB. Webserver is Apache. – Danijel Commented Jan 29, 2015 at 14:18
  • 1 Same problem here. Apache/Debian. – Jo Smo Commented Nov 10, 2016 at 20:25
Add a comment  | 

5 Answers 5

Reset to default 1

I solved it by adding

<?php header ("Connection: close"); ?> 

in file.php situated under wp-admin/include

Look at replay by Roberto:

https://stackoverflow/questions/33375823/error-dispatching-request-to-apache

RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500

By default Apache will stop upload after 20-30 seconds. With this directive placed into Apache config upload will continue up to 600 seconds as long as user is sending at least 500 bytes/s.

I ran into the same problem and tried doing a google search and came up with so many technical suggestions that I could not begin to even start as I'm not tech savvy. I did run into an article where a blogger said she contacted her hosting server and they changed the PHP version. It may or may not work for me but I was going to try.

Only I didn't know how to do that and I just got off with customer support and basically what he did was increase my bandwidth. I still couldn't upload. I did tell him in the add media library page it did say max upload file size was 2MB. But it wasn't until I refresh the page that the change kicked in and I saw my maximum upload file size was 256 MB. After that I was able to upload photos just fine!

I managed to resolve this problem with changing Apache server configuration: there is a KeepAlive flag which needs to be turned Off.

More about this flag:

Apache Optimization: KeepAlive On or Off?

I solved this, by removing libapache2-mod-php5filter:

apt-get remove libapache2-mod-php5filter

and installing libapache2-mod-php5:

apt-get install libapache2-mod-php5
发布评论

评论列表(0)

  1. 暂无评论