Page 1 of 1

Large Uploads

Posted: Mon Jan 11, 2010 12:20 pm
by daebat
When I test my uploads with small files everything populates into the database and uploads folder just fine...

Return from print_r($_FILES):
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
)

)
When I upload large files nothing populates except for the auto incremented id number, no files in the uploads folder and returns:
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>
When the upload fails it returns:

Array
(
)

Anybody have any solutions to large uploads through php?

Re: Large Uploads

Posted: Mon Jan 11, 2010 12:30 pm
by infolock
have you tried checking the php.ini settings to make sure that the limits you have set are not too small to handle your file upload?

Re: Large Uploads

Posted: Mon Jan 11, 2010 12:51 pm
by daebat
Yes, I think it is a problem with my execution time. We are trying to upload larger files (around 20-40 mb per upload). Can php handle this or should I consider another option?

PS what is that you're holding up in your picture?

Re: Large Uploads

Posted: Mon Jan 11, 2010 1:22 pm
by infolock
Execution time can also be updated, but instead of that, tell me what your MEMORY is set to in the php.ini file. It may not be large enough to handle huge files.


also, this isn't me in the picture, it's a buddy of mine. he is holding a bobcat he killed that was attacking his beagle rabbit dogs =P