Click to See Complete Forum and Search --> : Upload problems


Anon
05-14-2001, 01:48 PM
I am having some problems with uploading large files (100 MB) with PHP.

I am using PHP to handle a form-to-email site that I am constructing. Currently, I am able to get the message through to the e-mail, but the attachment is comming back corrupt and only 64 bytes.

I am running an NT server with IIS 4.0

Can anyone help me???

phillip
05-14-2001, 06:16 PM
hi tony!

size does matter ...
... in two places exacly:

* in the html form that you use to upload the data, specify the max_file_size:
<input type="hidden" name="max_file_size" value="10485768">

* in the php config file (php.ini on win32):
set the 'upload_max_filesize' large enough

i am not sure if this is the solution but that's what i'd try first.
afaik sending email with attachment isn't trivial, so maybe the problem lies there and not in the file upload. try one step at a time to find out what doesn't work:
a) upload a 100mb file to the server and check if it is saved successfully
b) send an email with attachment (small)

good luck,
phil!

phillip
05-14-2001, 06:19 PM
...
<input type="hidden" name="max_file_size" value="10485768">
...
please note that the html is only an example - 10MB filesize limit here.

phil!

Anon
05-15-2001, 02:22 PM
Thanks for replying. I have tried this out but with no success. I have also changed all the settings in php.ini (upload_max_filesize, memory_limit, max_execution_time, and post_max_size. None of these have fixed my problem.

I will try switching over to a Windows 2000 server and see if that makes a difference. I don't see how it will, but maybe something will be corrected when I re-install PHP4.

If you have any other suggestions, I would be very greatful to hear them.

Tony

phillip
05-15-2001, 05:09 PM
hi tony,

sorry i couldn't help you. some more ideas:

myabe the webserver also has an max_filsesize limit. i just tried to upload a +100MB file on my configuration (Win2k, Apache 1.3.19, PHP4.0.4, IE5.0) it didn't work. looked almost as if the file couldn't be saved in the php temp directory.
btw. are you sure you have enough space in the php temp dir as well as in the final save dir on your webserver?
have you determined if the problem really lies in the upload process? maybe mailing with such a huge attachment is failing? try to test these two processes separately.

i'm sure the web has the answer to your prob.
when i was gathering info about HTTP POST uploads i found a handful of sites -
a good starting point would be the php manual secion on file uploading:
http://www.php.net/manual/en/html/features.file-upload.html
and make sure to ask google ;-)

and make sure to let us know when you find the solution!

bye & good luck,
phil!

phillip
05-15-2001, 05:24 PM
sorry for always sending 2 replies ...

check
http://www.phpbuilder.com/forum/read.php3?num=2&id=125815&loc=0&thread=118340
same problem some time ago. maybe he knows the solution now.
every webserver seems to have a 'max_upload_filesize' for POST requests, too. i believe apache calls this POST_MAX.
phil.

Anon
05-15-2001, 05:32 PM
Thanks for the ideas, I will check to see what part of my config is failing. I believe that it lies in my php.ini file, but I will look into seeing if my server has a max post limit on it. I am currently running Win NT, IIS 4.0, PHP 4.0.5, IE 5.50.

I am moving my site to a Win 2000 server, so maybe I will have some better luck there.

I will make sure to tell you if I find something out about this uploading problem.

I have monitored my uploads and could tell that they are reaching the server, but I cannot find the temp files, or anything else. The e-mail attachment looks fine, except that the file is corrupt. I believe the problem to be between my web server and my SMTP server.

I will check out the issues that you have told me about, and will see if they have found a solution that works for me.


Thank you for your help,

Tony

Anon
05-15-2001, 06:56 PM
memory_limit=8M ; Maximum amount of memory a script may consume (8MB)

; Maximum size of POST data that PHP will accept.
post_max_size=8M

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads=On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir=

; Maximum allowed size for uploaded files.
upload_max_filesize=2M

jfloupe
05-17-2001, 03:41 AM
I meet similar problems with the upload, using NT4 and IIS. I want to upload large files through the Intranet. To test this, I develop a small prototype of 2 files :

1. input file :

<FORM ENCTYPE="multipart/form-data" ACTION="upload1.php" METHOD=POST>
Send this file: <INPUT NAME="fileupload" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>

2. Action file :

<?php
echo "$fileupload<br>$fileupload_name";
if ($fileupload_name!=""){
if (copy($fileupload,"c:\\tmp\\upload".$fileupload_name))echo "OK"; else echo "error";}
?>

This prototype works with small files, but in any case, this is very slow. I tried with a 40MB file and locally and the process takes more than 15 minutes. I repeat the test through the network on a server but the process never finished. I had to stop it with the task manager after 2 hours. Somebody can help me ?

Anon
05-17-2001, 03:22 PM
Ok, I think that my problem is getting fixed! I am able to upload large files to my web server, but they aren't getting anywhere after that. The files are saved as a random file name with an extention of .tmp.

Does anyone know what might be causing my files not to be sent through e-mail?

Small files work okay (there a little slow), but large files never make it through.


You guys have been very helpful so far, maybe soon, we will be able to get this going.


Tony

JF Loupe wrote:
-------------------------------
I meet similar problems with the upload, using NT4 and IIS. I want to upload large files through the Intranet. To test this, I develop a small prototype of 2 files :

1. input file :

<FORM ENCTYPE="multipart/form-data" ACTION="upload1.php" METHOD=POST>
Send this file: <INPUT NAME="fileupload" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>

2. Action file :

<?php
echo "$fileupload$fileupload_name";
if ($fileupload_name!=""){
if (copy($fileupload,"c:\\tmp\\upload".$fileupload_name))echo "OK"; else echo "error";}
?>

This prototype works with small files, but in any case, this is very slow. I tried with a 40MB file and locally and the process takes more than 15 minutes. I repeat the test through the network on a server but the process never finished. I had to stop it with the task manager after 2 hours. Somebody can help me ?

Anon
09-25-2001, 01:08 PM
Hi there !

The problem JF reported is still there, and it even appears with Apache+PHP+Win2k ... so it seems to be a usual PHP for windows-Problem.

And some kind of similar problem seems to appear the opposite way: pushing a file to stdout by using fopen() and fpassthru() takes 99% of the systems processing-time, uses twice as much memory as the file itself and needs a full quater to let the client-browsers download-dialog appear. After this, the download through my intranet speeds up to 2 MB/sec. This looks like a defective memory-management to me.

Someone has got an idea how to handle this ? Some workaround maybe or some configuration ?