Jump to content

Does anyone here have experience with large file uploads failing?


Vigilant Psyche

Recommended Posts

phpinfo confirms that upload_max_filesize is set to 128M but uploads of over 2M seem to fail without throwing errors:

 


echo "<tr><td class='content'>
						<span style='font-size:10px;'>(7z,gm6,gm7z,gmd,gmk,gml,png,jpeg, gif,jpg,mid,midi,pdf,psd,rar,swf,txt,zip)</span><br/><br/>
						<form action='index.php?body=upload' method='post'
						enctype='multipart/form-data'>
						<label for='file'>Filename:</label>
						<input type='file' name='file' id='file' />
						<input type='submit' name='submit' value='Upload' />
						</form>";

						if ($_FILES["file"]["size"]!=0)
						{
							$types="7z,gm6,gm7z,gmd,gmk,gml,JPEG,GIF,JPG,PNG,jpeg,gif,jpg,mid,midi,pdf,png,psd,rar,swf,txt,zip,mp3";
							$types=explode(",", ".".$types);

							$good=0;

							foreach($types as $ext)
							{
								$tmp = explode('.', $_FILES["file"]["name"]);
								$ext2 = $tmp[count($tmp)-1];

								if($ext2 == $ext)
								{
									$good=1;

								}
							}

								if ($good==0)
								{
									echo "<span style='font-size:18;'>The type of file the you have attempted to upload isn't allowed. <br/>Please make sure the following are adhered to:</span><br/><br/>

									<img src='images/tick.png' style='vertical-align:middle;'>  <span style='font-size:19;vertical-align:middle;text-align:right;'>We don't allow bitmap images (*.bmp). You must compress the file to .jpeg, .png or .gif.</span><br/><br/>

									<img src='images/tick.png' style='vertical-align:middle;'>  <span style='font-size:19;vertical-align:middle;text-align:right;'>Only files on the above list are allowed.</span><br/><br/>

									<img src='images/tick.png' style='vertical-align:middle;'>  <span style='font-size:19;vertical-align:middle;text-align:right;'>Executables, or web type files are not allowed, these must be compressed to .zip or .rar.</span><br/><br/><br/><br/>";
								}
								else
								{
									if($_FILES["file"]["size"] < 7000000)
									{

										$file_clean=$_FILES["file"]["name"];
										$file_clean=str_replace(" ","_",$file_clean);

										 move_uploaded_file($_FILES["file"]["tmp_name"],"uploads/".cookie_name()."/".$file_clean);
										 echo "File uploaded successfully.<br/><br/>";
									}
									else
									echo("<table><tr><td style='vertical-align:top;'><img src='images/cross.png' ></td><td width=5></td><td><span style='font-size:19;vertical-align:top;text-align:right;color:white;'>The file is over the size limit.<br><br/>File size limit: 7mb. <br/>Your file size: ".($_FILES["file"]["size"]/1000000)." mb.<br/><br/>Try compressing the file further.</span></td></tr></table><br/><br/><br/>");
								}
						}

						if ($handle = opendir('./uploads/'.cookie_name())) 
						{
						    while (false !== ($file = readdir($handle)))
							{
								if ($file != "." && $file != "..") 
								{
									echo "<div><div style='float:left;'><img src='uploaded.png' style='vertical-align:middle;'>  <span style='font-size:20;vertical-align:middle;'><a href='/uploads/".cookie_name()."/".$file."'>".$file."</a></span></div>
									<div style='float:right;'><a href='index.php?body=upload&delete=$file'><image border='0' src='images/delete.png'></a></div></div><br/><br/>";
								}
						    }
						    closedir($handle);
						}
					}

 

 

cookie_name() is the persons username.

 

Any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.