Hey guys,
Basicly my nephew has just been born and I need to put soem images on my site for my grand parents (the great grad parents) to see.
I can upload smaller galleries and all is well but for some reason if I upload a larger archive, for example 54M this doesn't work.
I have added a php.ini file to the scripts directory that reads:
upload_max_filesize = 190M
post_max_size = 200M
However this doesn't effect it.
What happens is that when the archive is uploaded it is extracted the images are resized then put into a random string folder. Then the script is supposed to echo out a form that will add the gallery information to a Sql database. However when a large file is uploaded the script just goes dead.
I have heard of this before and I thought the post_max_size was supposed to resolve this, no?
Thanks in advance.
Script:
<?php
if( isset( $_COOKIE['Username'] ) && $ui['Acc_Type'] == "adm" ) {
?>
<?php
if( !isset( $_GET['pro'] ) ) {
?><h1>Add Gallery</h1>
<p>To begin please upload a zip file containing all the images you wish to be in the gallery.</p>
<form method="post" action="?pro=uploading" enctype="multipart/form-data">
<label for="archive">Archive:</label>
<input type="file" name="file" id="file" />
<input type="submit" value="Upload" />
</form>
<?php
}
if( $_GET['pro'] == "uploading" ) {
?>
<?php
if( !isset( $_FILES['file']['name'] ) ) {
$err++;
$cor .= '<li>You must select an archive to upload</li>';
} else {
$ext = explode( "." , $_FILES['file']['name'] );
$count = 0;
while( $ext[$count] == true ) {
$count++;
}
$ext = $ext[$count-1];
if( ( $ext != "zip" ) &&
( $ext != "ZIP" ) ) {
$err++;
$cor .= '<li>Your archive must be in the correct zip format</li>';
}
if( $_FILES['file']['size'] / 1024 / 1024 > 75 ) {
$err++;
$cor .= '<li>Your file can\'t be more than 75MB</li>';
}
}
if( $err > 0 ) {
echo '<h1>Ooopsey errors...</h1>';
echo '<ul>'.$cor.'</ul>';
?>
<p>To begin please upload a zip file containing all the images you wish to be in the gallery.</p>
<form method="post" action="?pro=uploading" enctype="multipart/form-data">
<label for="file">Archive:</label>
<input type="file" name="file" id="file" />
<input type="submit" value="Upload" />
</form>
<?php
} else {
$code = sha1( time() . $ui['Username'] );
@mkdir( "/home/exuhlno/public_joshconnerty/pictures/gallery/".$code."/" , 0755 );
chmod( "/home/exuhlno/public_joshconnerty/pictures/gallery/".$code."/" , 0755 );
@mkdir( "/home/exuhlno/public_joshconnerty/pictures/gallery/".$code."/large/" , 0755 );
chmod( "/home/exuhlno/public_joshconnerty/pictures/gallery/".$code."/large/" , 0755 );
if( @move_uploaded_file( $_FILES['file']['tmp_name'] , "/home/exuhlno/public_joshconnerty/pictures/gallery/".$code."/".$code.".".$ext ) ) {
sql_con();
$q = mysql_query("INSERT INTO galleries (id) VALUES ('$code')");
extractZip( "/home/exuhlno/public_joshconnerty/pictures/gallery/$code/" , "$code.$ext" );
unlink( "/home/exuhlno/public_joshconnerty/pictures/gallery/$code/$code.$ext" );
//define the path as relative
$path = "/home/exuhlno/public_joshconnerty/pictures/gallery/$code/";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
//running the while loop
while ($file = readdir($dir_handle))
{
if($file!="." && $file!="..") {
@resize( "/home/exuhlno/public_joshconnerty/pictures/gallery/$code/$file" , 500 , $path."large/".$file );
@resize( "/home/exuhlno/public_joshconnerty/pictures/gallery/$code/$file" , 80 , $path."$file" );
copy( "/home/exuhlno/public_joshconnerty/inc/editimages.php" , "/home/exuhlno/public_joshconnerty/pictures/gallery/$code/editimages.php" );
}
}
//closing the directory
closedir($dir_handle);
?>
<h1>Upload Successfull</h1>
<p>Please edit the gallery details below.</p>
<form method="post" action="checkGal.php" target="target">
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
<input type="hidden" name="id" value="<?=$code?>" />
<label for="desc">Description:</label>
<textarea cols="30" rows="10" name="desc" id="desc"></textarea><br />
Permissions:<br />
<input type="checkbox" name="fri" value="1" /> Friends<br />
<input type="checkbox" name="fam" value="1" /> Family<br />
<span class="cont">
<input type="checkbox" name="pub" value="1" onclick="makePublic();" /> Public<br />
</span>
<input type="submit" value="Save" />
</form>
<div class="result"></div>
<iframe src="#" style="border: none;" name="target" id="target"></iframe>
<?php
}
}
?>
<?php
}
if( $_GET['pro'] == "savegal" ) {
}
?>
<?php
} else {
restricted("Admin Control Panel");
}
?>