i am attempting to have users upload files from their computer to a web server. i seem to be experiencing a timeout in both IE and NN. i have changed webserver and php.ini settings accordingly, but still...
i know this has been gone over and over, but i have researched this thing as far as i can go on it, and while people are saying they can upload these large files, no one is telling what network environment, what browser, etc. i have every setting set, and the code works, i know, for smaller files.
webserver:
win2k adv server
IIS 5
php 4.1.0
webserver settings:
connection timeout = 1800
php.ini settings:
max_execution_time = 1800
memory_limit = 50M
post_max_size = 50M
file_uploads = On
upload_tmp_dir = c:\php\upload_temp
upload_max_filesize = 50M
i can upload files fine, until the filesize
is greater than what i can upload within the
timeout. IE times out at about 5 minutes,
and NN varies around there. so far, the
largest file i have been able to upload was
about
i have tried the ReceiveTimeout registry
entry for IE, but it does NOT work in IE6.
i have a prefs.js entry for NN that might work, but have to wait until tonight to test it out.
now, i know it is the browser that is timing out [at home at least]. is there a way to keep sending pertinent info to the browser during a copy() function, in order to keep the connection alive, and not have the browser timeout?
or, is there another way to do a file upload via the broswer, without the timeout? or can we just fix the darn timeout? lol
if anyone would like to test out the script, it can be found here:
http://www.antipersonnel.org/ordnance/musicbox/upload.php
please do not be malicious, the error handling was removed in order to debug the timeout.
files uploaded will be located here:
http://www.antipersonnel.org/index.php?directory=upload
praying for some help here 🙂 thanks in advance!
sincerely,
mikeD
here is the code:
<?
$sizelimit = "no";
$sizebytes = "200000";
$dl = "http://www.antipersonnel.org/ordnance/musicbox/upload";
$absolute_path = "d:/inetpub/wwwroot/antipersonnel.org/upload";
$websiteurl = "http://www.antipersonnel.org";
$websitename = "antipersonnel.org";
switch($action) {
default:
echo"
<head>
<title>upload</title>
</head>
<body>
<a href=$PHP_SELF?action=upload>Upload File</a>
<a href=$websiteurl>Return to $websitename</a>
</body>
";
break;
case "upload":
echo"
<head>
<title>upload</title>
</head>
<body>
<form method=POST enctype=multipart/form-data action=$PHP_SELF?action=doupload>
<p>File to upload:<br>
<input type=file name=file size=30>
<p><input value=submit name=submit type=submit>
</form>
</body>
";
break;
//File Upload
case "doupload":
$dir = "dir";
if ($file != "") {
if (file_exists("$absolute_path/$file_name")) {
die("File already exists");
}
if (($sizelimit == "yes") && ($file_size > $sizebytes)) {
die("File is to big. It must be $sizebytes bytes or less.");
}
copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server");
} else {
die("Must select file to upload");
}
echo "
<head>
<title>uploaded</title>
</head>
<body>";
echo $file_name." was uploaded";
echo "<br>
<a href=$PHP_SELF?action=upload>Upload Another File</a>
<a href=$websiteurl> Return to $websitename</a>
</body>
";
break;
}
?>