Discussion:
problems with uploads to wordpress
Robin Paulson
2011-12-02 21:44:56 UTC
Permalink
i'm having some issues uploading files to my wordpress installation.
when i try, i get "Error saving media attachment." at the top of the
screen.

i've done a few searches and the only thing which might be relevant is
the size. i can upload a small png no problem, but the 3.6MB .xpi files
causes problems as it is beyond the maximum of 2MB. so, i increased the
value of upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it
still fails

any ideas what might be the problem?
--
robin

http://fu.ac.nz - Auckland's Free University


_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Nick Rout
2011-12-02 21:55:47 UTC
Permalink
i'm having some issues uploading files to my wordpress installation. when i
try, i get "Error saving media attachment." at the top of the screen.
i've done a few searches and the only thing which might be relevant is the
size. i can upload a small png no problem, but the 3.6MB .xpi files causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
any ideas what might be the problem?
Did you restart apache? I am not sure if that is needed, but might be
worth a try.

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Robin Paulson
2011-12-02 21:58:38 UTC
Permalink
On Sat, Dec 3, 2011 at 10:44 AM, Robin Paulson
i'm having some issues uploading files to my wordpress installation. when i
try, i get "Error saving media attachment." at the top of the
screen.
i've done a few searches and the only thing which might be relevant is the
size. i can upload a small png no problem, but the 3.6MB .xpi files causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
any ideas what might be the problem?
Did you restart apache? I am not sure if that is needed, but might be
worth a try.
yes, already done that thanks.
--
robin

http://fu.ac.nz - Auckland's Free University

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Glenn Enright
2011-12-02 22:20:55 UTC
Permalink
Post by Robin Paulson
Post by Nick Rout
i'm having some issues uploading files to my wordpress installation. when i
try, i get "Error saving media attachment." at the top of the screen.
i've done a few searches and the only thing which might be relevant is the
size. i can upload a small png no problem, but the 3.6MB .xpi files causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
any ideas what might be the problem?
Did you restart apache? I am not sure if that is needed, but might be
worth a try.
yes, already done that thanks.
--
Depending on how apache is configured there may be security rules
limiting that. What modules do you have in place? Is there a seperate
php.ini for the site itself?

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Robin Paulson
2011-12-02 23:25:42 UTC
Permalink
Post by Glenn Enright
Depending on how apache is configured there may be security rules
limiting that. What modules do you have in place? Is there a seperate
from /etc/apache2/mods-enabled$:

actions.load authz_host.load dav.load mime.conf
proxy_http.load ssl.conf
alias.conf authz_user.load dav_lock.load mime.load
proxy.load ssl.load
alias.load autoindex.conf deflate.conf negotiation.conf
reqtimeout.conf status.conf
auth_basic.load autoindex.load deflate.load negotiation.load
reqtimeout.load status.load
authn_file.load cgi.load dir.conf php5.conf
rewrite.load
authz_default.load dav_fs.conf dir.load php5.load
setenvif.conf
authz_groupfile.load dav_fs.load env.load proxy.conf
setenvif.load
Post by Glenn Enright
php.ini for the site itself?
no, where would it be? i assume the one in /etc is used unless there is
one in the specific wp directory?
--
robin

http://fu.ac.nz - Auckland's Free University

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
David Pando
2011-12-02 22:28:13 UTC
Permalink
i'm having some issues uploading files to my wordpress installation. when
i try, i get "Error saving media attachment." at the top of the screen.
i've done a few searches and the only thing which might be relevant is the
size. i can upload a small png no problem, but the 3.6MB .xpi files causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
Increasing upload_max_filesize is not usually enough, as you also have to
increase post_max_size .
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Robin Paulson
2011-12-02 23:22:49 UTC
Permalink
Post by David Pando
size. i can upload a small png no problem, but the 3.6MB .xpi files causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
Increasing upload_max_filesize is not usually enough, as you also have to
increase post_max_size .
that's at 8MB already, should it be bigger than upload_max_filesize by
some factor?
--
robin

http://fu.ac.nz - Auckland's Free University

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Steve Holdoway
2011-12-02 23:47:43 UTC
Permalink
Post by Robin Paulson
Post by David Pando
size. i can upload a small png no problem, but the 3.6MB .xpi files causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
Increasing upload_max_filesize is not usually enough, as you also have to
increase post_max_size .
that's at 8MB already, should it be bigger than upload_max_filesize by
some factor?
You can also set MAX_FILE_SIZE in a form to limit it. Also, check that
the default upload_max_filesize and post_max_size aren't being
overridden either in code or .htaccess.

hth,

Steve
--
Steve Holdoway BSc(Hons) MNZCS <***@greengecko.co.nz>
http://www.greengecko.co.nz
MSN: ***@greengecko.co.nz
Skype: sholdowa
Robin Paulson
2011-12-02 23:59:47 UTC
Permalink
Post by Steve Holdoway
Post by Robin Paulson
Post by David Pando
Post by Robin Paulson
size. i can upload a small png no problem, but the 3.6MB .xpi
files
Post by David Pando
Post by Robin Paulson
causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
Increasing upload_max_filesize is not usually enough, as you also have to
increase post_max_size .
that's at 8MB already, should it be bigger than upload_max_filesize by
some factor?
You can also set MAX_FILE_SIZE in a form to limit it. Also, check that
i'm not sure what you mean by "a form"
Post by Steve Holdoway
the default upload_max_filesize and post_max_size aren't being
overridden either in code or .htaccess.
i haven't defined any .htaccess files, where in the code is it likely
to be altered? the web searches i ahve found point to wordpress taking
whatever is defined by php as the limiting factor
--
robin

http://fu.ac.nz - Auckland's Free University

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Steve Holdoway
2011-12-03 00:26:38 UTC
Permalink
Post by Robin Paulson
Post by Steve Holdoway
Post by Robin Paulson
Post by David Pando
Post by Robin Paulson
size. i can upload a small png no problem, but the 3.6MB .xpi
files
Post by David Pando
Post by Robin Paulson
causes
problems as it is beyond the maximum of 2MB. so, i increased the value of
upload_max_filesize in /etc/php5/apache2/php.ini to 5MB, but it still fails
Increasing upload_max_filesize is not usually enough, as you also have to
increase post_max_size .
that's at 8MB already, should it be bigger than upload_max_filesize by
some factor?
You can also set MAX_FILE_SIZE in a form to limit it. Also, check that
i'm not sure what you mean by "a form"
Most uploads are controlled by a button saying 'go'. In the pre-ajax
world at least. This is encompassed in a <form></form> block.
Post by Robin Paulson
Post by Steve Holdoway
the default upload_max_filesize and post_max_size aren't being
overridden either in code or .htaccess.
i haven't defined any .htaccess files, where in the code is it likely
to be altered? the web searches i ahve found point to wordpress taking
whatever is defined by php as the limiting factor
Exactly.

Defaults are in /etc/php.ini ( or in your debian/ubuntu / apache
case /etc/php5/apache2/php.ini ).
upload_max_filesize = 2M

Overrides can be put in .htaccess
php_value upload_max_filesize 2M

Or in php code
ini_set("upload_max_filesize", "2M");

hth,

Steve
--
Steve Holdoway BSc(Hons) MNZCS <***@greengecko.co.nz>
http://www.greengecko.co.nz
MSN: ***@greengecko.co.nz
Skype: sholdowa
Michael Adams
2011-12-03 20:34:24 UTC
Permalink
Post by Steve Holdoway
Post by Robin Paulson
Post by Robin Paulson
that's at 8MB already, should it be bigger than
Post by Robin Paulson
upload_max_filesize by
some factor?
You can also set MAX_FILE_SIZE in a form to limit it. Also, check that
i'm not sure what you mean by "a form"
An INPUT HTML Element is a FORM element. MAX_FILE_SIZE is often used
as shown:
<input type="hidden" name="max_file_size" value="500" />
<input type="file" />

May be worth a quick check. Max file size IIUC is set in KB; thus a
value of 500 = 500kb.
Post by Steve Holdoway
Most uploads are controlled by a button saying 'go'. In the
pre-ajax world at least. This is encompassed in a <form></form>
block.
Post by Robin Paulson
Post by Robin Paulson
the default upload_max_filesize and post_max_size aren't being
overridden either in code or .htaccess.
i haven't defined any .htaccess files, where in the code is it
likely to be altered? the web searches i ahve found point to
wordpress taking whatever is defined by php as the limiting
factor
Exactly.
Defaults are in /etc/php.ini ( or in your debian/ubuntu / apache
case /etc/php5/apache2/php.ini ).
upload_max_filesize = 2M
Overrides can be put in .htaccess
php_value upload_max_filesize 2M
Or in php code
ini_set("upload_max_filesize", "2M");
hth,
Steve
Add this code in ".htaccess":

php_value upload_max_filesize 8M
php_value post_max_size 8M
php_value max_execution_time 100
php_value max_input_time 100

You can increase the file upload limit according to your requirement.
--
Michael

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Martin D Kealey
2011-12-05 23:48:51 UTC
Permalink
Post by David Pando
Increasing upload_max_filesize is not usually enough, as you also have to
increase post_max_size .
that's at 8MB already, should it be bigger than upload_max_filesize by some
factor?
It all depends on how the data is encoded.

If both the server and the client (browser) do unencoded binary POST then
the same number will work for both.

To allow for base-64 encoding, a margin of around 1.4 would cover the 1.333
factor of the actual encoding, a 1.03 factor for extra whitespace, and a
teeny bit more for HTTP headers.

To allow for URI "percent" encoding, allow a factor of about 2.3: the 94
printable ASCII characters (excluding "%") are represented by themselves; all
other octets are represented by 3 octets, so the expansion ratio for linear
random data averages at 2.2656, but the actual expansion ratio will depend
on the data in any given case. (Using GET will use always percent-encoding.)

Of course, you may allow compression as well, in which case (if the client
and server agree) the ratio may be 0.33 or less.

-Martin

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Steve Holdoway
2011-12-06 00:03:49 UTC
Permalink
Post by Martin D Kealey
Of course, you may allow compression as well, in which case (if the client
and server agree) the ratio may be 0.33 or less.
As the OP was talking .xpi files, which are basically .zip archives, the
compression will be effectively zero...

Cheers,

Steve
--
Steve Holdoway BSc(Hons) MNZCS <***@greengecko.co.nz>
http://www.greengecko.co.nz
MSN: ***@greengecko.co.nz
Skype: sholdowa
Robin Paulson
2011-12-06 00:23:33 UTC
Permalink
Post by Steve Holdoway
Post by Martin D Kealey
Of course, you may allow compression as well, in which case (if the client
and server agree) the ratio may be 0.33 or less.
As the OP was talking .xpi files, which are basically .zip archives, the
compression will be effectively zero...
true, but it's always good to see martin's incredibly detailed and
comprehensive explanations
--
robin

http://fu.ac.nz - Auckland's Free University

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Steve Holdoway
2011-12-07 05:40:35 UTC
Permalink
Post by Robin Paulson
Post by Steve Holdoway
Post by Martin D Kealey
Of course, you may allow compression as well, in which case (if the client
and server agree) the ratio may be 0.33 or less.
As the OP was talking .xpi files, which are basically .zip archives, the
compression will be effectively zero...
true, but it's always good to see martin's incredibly detailed and
comprehensive explanations
These is another possibility. The LimitRequestBody can restrict file
size too... eg

<Directory [docroot]/wp-uploads>
LimitRequestBody 2097152
</Directory>

in either httpd.conf or .htaccess will limit wordpress uploads to 2MB.
--
Steve Holdoway BSc(Hons) MNZCS <***@greengecko.co.nz>
http://www.greengecko.co.nz
MSN: ***@greengecko.co.nz
Skype: sholdowa
Martin D Kealey
2011-12-08 04:43:27 UTC
Permalink
Of course, you may allow compression as well, in which case (if the c=
lient
and server agree) the ratio may be 0.33 or less.
As the OP was talking .xpi files, which are basically .zip archives, th=
e
compression will be effectively zero...
And of course, compressed files do a pretty good job of being "random" from
the point of view of octet distribution.

Going back for a moment, I think my comment about Base64 is a red herring;
the only time it's likely applicable is for webmail, because it knows about
MIME; anything else will probably use URL "percent" encoding, both for GET
and POST.

I also missed a couple of other characters which need to be encoded ("=3D" =
and
"&") leaving at most just 92 characters that don't need to be encoded, and
some client might encode other characters because it its author's name
contains a "=CE=9E".

So in summary, it's safest just to assume a multiplier of 3.

-Martin

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug

Loading...