[CODE4LIB] Very large file uploads, PHP or possibly Perl

2007-02-09 Thread Thomas Dowling
I have always depended on the kindness of strange PHP gurus.

I am trying to rewrite a perpetually buggy system for uploading large
PDF files (up to multiple tens of megabytes) via a web form.  File
uploads are very simple in PHP, but there's a default maximum file size
of 2MB.  Following various online hints I've found, I've gone into
php.ini and goosed up the memory_limit, post_max_size, and
upload_max_size (and restarted Apache), and added an appropriate hidden
form input named MAX_FILE_SIZE.  The 2MB limit is still in place.

Is there something I overlooked?  Or, any other suggestions for how to
take in a very large file?

[My current Perl version has a history of getting incomplete files in a
non-negligible percentage of uploads.  Weirdness ensues: whenever this
happens, the file reliably cuts off at the same point, but the cutoff is
not a fixed number of bytes, nor is it related to the size of the file.]


--
Thomas Dowling
[EMAIL PROTECTED]


Re: [CODE4LIB] Very large file uploads, PHP or possibly Perl

2007-02-09 Thread Andrew Darby

I haven't needed to upload such large files, but I wonder if using the
ftp functions in php would bypass this problem:

http://us3.php.net/manual/en/ref.ftp.php

Andrew

On 2/9/07, Thomas Dowling [EMAIL PROTECTED] wrote:

I have always depended on the kindness of strange PHP gurus.

I am trying to rewrite a perpetually buggy system for uploading large
PDF files (up to multiple tens of megabytes) via a web form.  File
uploads are very simple in PHP, but there's a default maximum file size
of 2MB.  Following various online hints I've found, I've gone into
php.ini and goosed up the memory_limit, post_max_size, and
upload_max_size (and restarted Apache), and added an appropriate hidden
form input named MAX_FILE_SIZE.  The 2MB limit is still in place.

Is there something I overlooked?  Or, any other suggestions for how to
take in a very large file?

[My current Perl version has a history of getting incomplete files in a
non-negligible percentage of uploads.  Weirdness ensues: whenever this
happens, the file reliably cuts off at the same point, but the cutoff is
not a fixed number of bytes, nor is it related to the size of the file.]


--
Thomas Dowling
[EMAIL PROTECTED]




--
Andrew Darby
Web Services Librarian
Ithaca College Library
http://www.ithaca.edu/library/
[EMAIL PROTECTED]


Re: [CODE4LIB] Very large file uploads, PHP or possibly Perl

2007-02-09 Thread Andrew Nagy

I have done large file uploads in PHP.  Make sure you have the following
set in php.ini:

upload_max_filesize = some large size followed by M for megabyte or G
for gigabyte
file_uploads = on
post_max_size = some large size

Also, you can set these values through the set_ini function in PHP so
that it can be per script instead of effective for every script which
can allow for a more granular level of control for security reasons, etc.

I have never used the form input value, nor should you have to change
the memory_limit very much since the file itself is not loaded into
memory, just information regarding the file.

Andrew

Thomas Dowling wrote:

I have always depended on the kindness of strange PHP gurus.

I am trying to rewrite a perpetually buggy system for uploading large
PDF files (up to multiple tens of megabytes) via a web form.  File
uploads are very simple in PHP, but there's a default maximum file size
of 2MB.  Following various online hints I've found, I've gone into
php.ini and goosed up the memory_limit, post_max_size, and
upload_max_size (and restarted Apache), and added an appropriate hidden
form input named MAX_FILE_SIZE.  The 2MB limit is still in place.

Is there something I overlooked?  Or, any other suggestions for how to
take in a very large file?

[My current Perl version has a history of getting incomplete files in a
non-negligible percentage of uploads.  Weirdness ensues: whenever this
happens, the file reliably cuts off at the same point, but the cutoff is
not a fixed number of bytes, nor is it related to the size of the file.]


--
Thomas Dowling
[EMAIL PROTECTED]



Re: [CODE4LIB] Very large file uploads, PHP or possibly Perl

2007-02-09 Thread Thomas Dowling
On 2/9/2007 11:50 AM, Jay Luker wrote:

 Pre-apologies if this suggestion is too duh, but have you confirmed
 that you updated the correct php.ini file?


Bless you!  This did the trick, and I can now upload really big files.
And I defy anyone to find something too duh for me.  :-)

Yes indeed, as our long-suffering sysadmin has responded to my requests
to rebuild PHP with various tweaks, he has created a series of .ini
files with PHP version numbers built into their names.

Thanks for reminding me that phpinfo would show this.


--
Thomas Dowling
[EMAIL PROTECTED]