Large Uploads
Posted: Mon Jan 11, 2010 12:20 pm
When I test my uploads with small files everything populates into the database and uploads folder just fine...
Return from print_r($_FILES):
When the upload fails it returns:
Array
(
)
Anybody have any solutions to large uploads through php?
Return from print_r($_FILES):
When I upload large files nothing populates except for the auto incremented id number, no files in the uploads folder and returns:FILES:Array
(
[image] => Array
(
[name] => FS10_CashForCalories_1col-x-3_sm.jpg
[type] => image/jpeg
[tmp_name] => /tmp/php3KBMci
[error] => 0
[size] => 22607
)
[thumb] => Array
(
[name] => FS10_CashForCalories_2col-x-3_sm.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpremu37
[error] => 0
[size] => 11959
)
[eps1] => Array
(
[name] => 2009-12-03_1124.png
[type] => image/png
[tmp_name] => /tmp/phpZTo3YX
[error] => 0
[size] => 12220
)
[eps2] => Array
(
[name] => 2009-12-03_1643.png
[type] => image/png
[tmp_name] => /tmp/phpyCk95N
[error] => 0
[size] => 81025
)
[pdf1] => Array
(
[name] => 2009-12-08_0955.png
[type] => image/png
[tmp_name] => /tmp/phpr8QfVE
[error] => 0
[size] => 9290
)
[pdf2] => Array
(
[name] => 2009-12-08_1012.png
[type] => image/png
[tmp_name] => /tmp/php2KCWOv
[error] => 0
[size] => 4671
)
)
Here is my processing code:
Code: Select all
<?
echo "<pre>";
echo "FILES:";
print_r($_FILES);
echo "</pre>";
//This is the directory where images will be saved
$target = "path";
//This gets all the other information from the form
$title=$_POST['title'];
$title2=$_POST['title2'];
$image = ($_FILES['image']['name']);
$thumb = ($_FILES['thumb']['name']);
$eps1 = ($_FILES['eps1']['name']);
$eps2=($_FILES['eps2']['name']);
$pdf1=($_FILES['pdf1']['name']);
$pdf2=($_FILES['pdf2']['name']);
// Connects to your Database
mysql_connect("localhost", "user", "pass") or die(mysql_error()) ;
mysql_select_db("db") or die(mysql_error()) ;
//Writes the information to the database
mysql_query("INSERT INTO printads (title,title2,image,thumb,eps1,eps2,pdf1,pdf2)
VALUES ('$title', '$title2', '$image', '$thumb', '$eps1', '$eps2', '$pdf1','$pdf2')");
foreach($_FILES as $file) {
move_uploaded_file($file['tmp_name'], $target . $file['name']);
}
?>
<p>Upload Successful... <a href="main.php">click here</a> to return to the administration area.</p>
</body>
</html>Array
(
)
Anybody have any solutions to large uploads through php?