So I am having problems when uploading larger files via an upload script. I am finding that once a file is over 20mb or so the script pretty much fails and the $_FILES[‘file’] array is empty. However, if I upload a smaller file it works fine.
I initially thought it was an issue with my upload_max_filesize in my php.ini, however when I set it to 100M the script is still failing.
Here is a link to a php info dump:
[url]http://theelysium.net/info.php
And here is my upload class:
[code=php]
class ImageUploader{
public function ImageUploader(){
global $root, $errors, $errorText, $media_url;
$errors = false;
if(!eregi(‘image/’, $_FILES[‘file’][‘type’]) && $_FILES[“file”][“type”] != “audio/mp3” && $_FILES[“file”][“type”] != “audio/mpeg”) {
$errorText .= “You must upload an image file”;
$errors = true;
};
$image_cap = 900;
$sound_cap = 70000;
if(eregi(‘image/’, $_FILES[‘file’][‘type’]) && $_FILES[‘file’][‘size’]/1024 > $image_cap){
$errorText .= “The image you are uploading must be 900Kb or smaller”;
$errors = true;
};
if( $_FILES[“file”][“type”] != “audio/mp3” || $_FILES[“file”][“type”] != “audio/mpeg”){
if($_FILES[‘file’][‘size’]/1024 > $sound_cap){
$errorText .= “The sound file you are uploading must be 70Mb or smaller”;
$errors = true;
}
}
if($_FILES[‘file’][‘name’] == “”){
$errorText .= “Please specify a file to upload.”;
$errors = true;
}
if($errors == false){
$path = $root.”clientImages/” . $_GET[‘client’] . “/”;
$this->makeDirectory($path);
$path .= $_GET[‘app’].”/”;
$this->makeDirectory($path);
$fn = explode(“.”,$_FILES[‘file’][‘name’]);
$name = $_GET[‘client’].”-“.$_GET[‘app’].”-“.$_GET[‘post’].”-“.floor(rand(0,99999)).”-“.$this->strip($fn[0]).”.”.$fn[sizeof($fn)-1];
$name = strtolower(str_replace(” “,””,$name));
$name = str_replace(“(“,””,$name);
$name = str_replace(“)”,””,$name);
$filePath = $path.$name;
$location = “http://”.$media_url.”/clientImages/” . $_GET[‘client’] . “/” . $_GET[‘app’].”/” . $name;
move_uploaded_file($_FILES[‘file’][‘tmp_name’], $filePath);
}
}
private function makeDirectory( $dirPath ){
if( !is_dir( $dirPath ) ){
if ( mkdir( $dirPath ) ){
return true;
}else{
return false;
}
}
}
private function strip($string){
return preg_replace(“/[^a-zA-Z0-9s]/”, “”, $string);
}
}
Thanks so much for any help yo can offer!