PHP script is launched after the download is completed; therefore, if there is a timeout at boot time, you cannot do anything in the script (since it will not be run at all).
If the timeout occurs during the script, you can break it into several parts - first the first script will simply save the downloaded file and redirect HTTP to another, which will do the processing and work with the database. In the script you are showing, the processing seems simple enough, not sure if this will help.
Assuming you are showing only a simplified version:
script1.php
$fname= basename($_FILES["image"]["name"][$x]);
$uniqid = uniqid("",true);
$path = "../../clients/$realClient/temporary/" . $uniqid . '/' . $fname;
move_uploaded_file($_FILES["image"]["tmp_name"][$x], $path);
header('Location: /script2.php?file=' . $uniqid . '/' . $fname);
script2.php
$path = $_GET['file'];
$uniqid = basename(dirname($path));
$fname = basename($path);
$temp_path = "../../clients/$realClient/temporary/" . $uniqid . '/' . $fname;
$final_path = "../../clients/$realClient/" . $fname;
move($temp_path,$final_path);
// do whatever processing is necessary
mysql_query("INSERT INTO images VALUES(NULL, '$displayPath', '$client', '$project', '$newWeight')") or die("Unable to Insert Image - Please Try Again");
echo "File Successfully Uploaded<br />";
source
share