Connect with Expertise | Find Experts, Get Answers, Share Insights

Overcoming upload_max_filesize

Joshua Beall
 
Posts: n/a
#1: Jul 17 '05
Hi All,

Is there any way for me to overcome the php.ini configuration
upload_max_filesize? I cannot use ini_set() since upload_max_filesize can
only be set in httpd.conf or php.ini. Are there any other options?

I have an image gallery script that I wrote that will take a very large
image, and resize it down to a reasonable size for the web. This makes it
easy for me to grab very high resolution images from my camera, and just
shoot them off to the web without messing with them in a separate program.
Unfortunately, I not infrequently have images that are bigger than 2 megs,
which is the default upload_max_filesize limit.

Any ideas? Or am I stuck asking my webhost to change the
upload_max_filesize?

Sincerely,
-Josh



Richard Grove
 
Posts: n/a
#2: Jul 17 '05

re: Overcoming upload_max_filesize


"Joshua Beall" <jbeall@donotspam.remove.me.heraldic.us> wrote in message
news:21FDb.12552$I6.4629@nwrddc03.gnilink.net...[color=blue]
> Hi All,
>
> Is there any way for me to overcome the php.ini configuration
> upload_max_filesize? I cannot use ini_set() since upload_max_filesize can
> only be set in httpd.conf or php.ini. Are there any other options?
>
> I have an image gallery script that I wrote that will take a very large
> image, and resize it down to a reasonable size for the web. This makes it
> easy for me to grab very high resolution images from my camera, and just
> shoot them off to the web without messing with them in a separate program.
> Unfortunately, I not infrequently have images that are bigger than 2 megs,
> which is the default upload_max_filesize limit.
>
> Any ideas? Or am I stuck asking my webhost to change the
> upload_max_filesize?
>
> Sincerely,
> -Josh
>
>[/color]

Nope, there is not usually a way to overcome this.
You should ask your host if they will change the php.ini.

Regards
Richard Grove

http://shopbuilder.org - ecommerce systems
Become a Shop Builder re-seller:
http://www.affiliatewindow.com/affil...ls.php?mid=611
http://www.affiliatewindow.com/a.pl?590





Janwillem Borleffs
 
Posts: n/a
#3: Jul 17 '05

re: Overcoming upload_max_filesize



"Joshua Beall" <jbeall@donotspam.remove.me.heraldic.us> schreef in bericht
news:21FDb.12552$I6.4629@nwrddc03.gnilink.net...[color=blue]
>
> Any ideas? Or am I stuck asking my webhost to change the
> upload_max_filesize?
>[/color]

You could try to put an .htaccess file in your website's root with the
following entry:

<IfModule mod_php4.c>
php_value upload_max_filesize 8M
</IfModule>

Besides php_value, you can also use php_flag to toggle directives which only
can be switched on or off.


JW



m-e-
 
Posts: n/a
#4: Jul 17 '05

re: Overcoming upload_max_filesize


I think you can't without accessing the root configuration files : it's a bandwidth protection.
Install a local server, or use php alone to be able to use your script.


Janwillem Borleffs
 
Posts: n/a
#5: Jul 17 '05

re: Overcoming upload_max_filesize



"Joshua Beall" <jbeall@donotspam.remove.me.heraldic.us> schreef in bericht
news:21FDb.12552$I6.4629@nwrddc03.gnilink.net...[color=blue]
>
> Is there any way for me to overcome the php.ini configuration
> upload_max_filesize? I cannot use ini_set() since upload_max_filesize can
> only be set in httpd.conf or php.ini. Are there any other options?
>[/color]

You could try to put an .htaccess file in your website's root with the
following entry:

<IfModule mod_php4.c>
php_value upload_max_filesize 8M
</IfModule>

Besides php_value, you can also use php_flag to toggle directives which only
can be switched on or off.


JW



clvrmnky
 
Posts: n/a
#6: Jul 17 '05

re: Overcoming upload_max_filesize


Joshua Beall wrote:
[color=blue]
> Hi All,
>
> Is there any way for me to overcome the php.ini configuration
> upload_max_filesize? I cannot use ini_set() since upload_max_filesize can
> only be set in httpd.conf or php.ini. Are there any other options?
>
> I have an image gallery script that I wrote that will take a very large
> image, and resize it down to a reasonable size for the web. This makes it
> easy for me to grab very high resolution images from my camera, and just
> shoot them off to the web without messing with them in a separate program.
> Unfortunately, I not infrequently have images that are bigger than 2 megs,
> which is the default upload_max_filesize limit.
>
> Any ideas? Or am I stuck asking my webhost to change the
> upload_max_filesize?
>[/color]
I think the rest of this threads means you are out of luck changing this
property.

Why not change your process so you break the images up into chunks for
uploading, and then assemble them locally. There are all kinds of
external apps that break images into pieces, and there must be PHP code
(or even libraries) that can reassemble these pieces once received.

Janwillem Borleffs
 
Posts: n/a
#7: Jul 17 '05

re: Overcoming upload_max_filesize



"Joshua Beall" <jbeall@donotspam.remove.me.heraldic.us> schreef in bericht
news:21FDb.12552$I6.4629@nwrddc03.gnilink.net...[color=blue]
>
> Is there any way for me to overcome the php.ini configuration
> upload_max_filesize? I cannot use ini_set() since upload_max_filesize can
> only be set in httpd.conf or php.ini. Are there any other options?
>[/color]

You could try to put an .htaccess file in your website's root with the
following entry:

<IfModule mod_php4.c>
php_value upload_max_filesize 8M
</IfModule>

BTW, besides php_value, you can also use php_flag to toggle directives which
only
can be switched on or off.


JW



Joshua Beall
 
Posts: n/a
#8: Jul 17 '05

re: Overcoming upload_max_filesize


"clvrmnky" <clvrmnky-uunet@coldmail.com.invalid> wrote in message
news:XPHDb.140703$PD3.5852052@nnrp1.uunet.ca...[color=blue]
> I think the rest of this threads means you are out of luck changing this
> property.
>
> Why not change your process so you break the images up into chunks for
> uploading, and then assemble them locally. There are all kinds of
> external apps that break images into pieces, and there must be PHP code
> (or even libraries) that can reassemble these pieces once received.[/color]

But to do this, I would have to split the file locally, myself (unless I
misunderstand the idea); in this case it sounds like I would be better off
just resizing the image locally, instead of having to split the file.


Joshua Beall
 
Posts: n/a
#9: Jul 17 '05

re: Overcoming upload_max_filesize


"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:3fdf36b0$0$123$1b62eedf@news.wanadoo.nl...[color=blue]
>
> You could try to put an .htaccess file in your website's root with the
> following entry:
>
> <IfModule mod_php4.c>
> php_value upload_max_filesize 8M
> </IfModule>
>[/color]

Interesting... according to the PHP manual, this should not work - the
upload_max_filesize setting is supposed to only be settable in php.ini and
httpd.conf, not in .htaccess files.

But, I decided to try it anyway. And it worked! I am using PHP 4.3.4. Is
this a bug in PHP that I am able to set it in .htaccess files?

-Josh


Andy Hassall
 
Posts: n/a
#10: Jul 17 '05

re: Overcoming upload_max_filesize


On Tue, 16 Dec 2003 21:59:39 GMT, "Joshua Beall"
<jbeall@donotspam.remove.me.heraldic.us> wrote:
[color=blue]
>"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
>news:3fdf36b0$0$123$1b62eedf@news.wanadoo.nl...[color=green]
>>
>> You could try to put an .htaccess file in your website's root with the
>> following entry:
>>
>> <IfModule mod_php4.c>
>> php_value upload_max_filesize 8M
>> </IfModule>[/color]
>
>Interesting... according to the PHP manual, this should not work - the
>upload_max_filesize setting is supposed to only be settable in php.ini and
>httpd.conf, not in .htaccess files.
>
>But, I decided to try it anyway. And it worked! I am using PHP 4.3.4. Is
>this a bug in PHP that I am able to set it in .htaccess files?[/color]

It's a documentation bug.

PHP 4.3.4, main/main.c:343

STD_PHP_INI_ENTRY("upload_max_filesize", "2M",
PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateInt,
upload_max_filesize, php_core_globals, core_globals)

The manual claims only PHP_INI_SYSTEM.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
John Dunlop
 
Posts: n/a
#11: Jul 17 '05

re: Overcoming upload_max_filesize


Andy Hassall wrote:
[color=blue]
> It's a documentation bug.[/color]

#24955 ;-)

--
Jock
Jon Kraft
 
Posts: n/a
#12: Jul 17 '05

re: Overcoming upload_max_filesize


"Joshua Beall" <jbeall@donotspam.remove.me.heraldic.us> wrote:
[color=blue]
> Is there any way for me to overcome the php.ini configuration
> upload_max_filesize? I cannot use ini_set() since upload_max_filesize
> can only be set in httpd.conf or php.ini. Are there any other
> options?
>
> I have an image gallery script that I wrote that will take a very
> large image, and resize it down to a reasonable size for the web.
> This makes it easy for me to grab very high resolution images from my
> camera, and just shoot them off to the web without messing with them
> in a separate program. Unfortunately, I not infrequently have images
> that are bigger than 2 megs, which is the default upload_max_filesize
> limit.
>
> Any ideas? Or am I stuck asking my webhost to change the
> upload_max_filesize?[/color]

Hi Josh,

Either that or you install Apache, PHP, (Mysql) on your local machine
and run the resize script there and then upload them to your web host.

JOn
Kman
 
Posts: n/a
#13: Jul 17 '05

re: Overcoming upload_max_filesize


You could use ftp functions of php instead of normal HTTP upload. This will
sneak the limit thing.

Kman


"Joshua Beall" <jbeall@donotspam.remove.me.heraldic.us> wrote in message
news:21FDb.12552$I6.4629@nwrddc03.gnilink.net...[color=blue]
> Hi All,
>
> Is there any way for me to overcome the php.ini configuration
> upload_max_filesize? I cannot use ini_set() since upload_max_filesize can
> only be set in httpd.conf or php.ini. Are there any other options?
>
> I have an image gallery script that I wrote that will take a very large
> image, and resize it down to a reasonable size for the web. This makes it
> easy for me to grab very high resolution images from my camera, and just
> shoot them off to the web without messing with them in a separate program.
> Unfortunately, I not infrequently have images that are bigger than 2 megs,
> which is the default upload_max_filesize limit.
>
> Any ideas? Or am I stuck asking my webhost to change the
> upload_max_filesize?
>
> Sincerely,
> -Josh
>
>[/color]


Joshua Beall
 
Posts: n/a
#14: Jul 17 '05

re: Overcoming upload_max_filesize


"Kman" <kman_career@yahoo.com> wrote in message
news:j28Fb.7063$vT2.39203@news20.bellglobal.com...[color=blue]
> You could use ftp functions of php instead of normal HTTP upload. This[/color]
will[color=blue]
> sneak the limit thing.
>
> Kman[/color]

How would I do this? Would not the user have to open an FTP connection
manually, or be running his own FTP server in order to allow the php script
to connect to him and grab the file?

If you have an example I would be most curious to look at it.

-jb


Closed Thread