sudeepr71 Posted September 3, 2008 Share Posted September 3, 2008 Hi, I'm trying to create a website that will allow users to upload video files that are less than 100mb. Right now, I can only get a video file that is less than 8mb to upload. I've got it hosted on GoDaddy. They told me to change the php.ini file to: memory_limit = 1000M post_max_size = 100M file_uploads = On upload_max_filesize = 100M Here is the entire php.ini file: register_globals = off allow_url_fopen = off expose_php = Off variables_order = "EGPCS" extension_dir = ./ upload_tmp_dir = /tmp precision = 12 memory_limit = 1000M post_max_size = 100M file_uploads = On upload_max_filesize = 100M SMTP = relay-hosting.secureserver.net url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" [Zend] zend_extension=/usr/local/zo/ZendExtensionManager.so zend_extension=/usr/local/zo/4_3/ZendOptimizer.so I've tried everything and need a lot of help! Below is my code for uploading. It first removes the extension from the file. Then renames it with a randomly generated number. Next, it a "." and then finally the extension. Lastly, it moves the file from the temp to the "uploads" folder. <?php //path where we want to upload the files to on the server $target_path = "uploads/"; // random number generator function createRandomPassword() { $chars = "023456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 6) { $num = rand() % 15; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $autopw = createRandomPassword(); //Separates the extension from the rest of the file name and returns it function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } //This applies the function to our file $ext = findexts ($_FILES['uploadedfile']['name']) ; //This adds a . to the end of our random number $key = $autopw."."; //This adds the extension to the end $target_path = $target_path . $key.$ext; //This moves the file from temp to our uploads directory and then confirms it if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded as ". $key.$ext; } else{ echo "There was an error uploading the file, please try again!"; } ?> Like I said before, I can upload a file that is less than 8mb. Anything bigger, I get the error message. Please help me, I need to figure this out asap! Quote Link to comment Share on other sites More sharing options...
zq29 Posted September 3, 2008 Share Posted September 3, 2008 Have you restarted Apache after making those changes to the php.ini? Quote Link to comment Share on other sites More sharing options...
ksmatthews Posted September 3, 2008 Share Posted September 3, 2008 THis might help .. The apache webserver has a LimitRequestBody configuration directive that restricts the size of all POST data regardless of the web scripting language in use. Some RPM installations sets limit request body to 512Kb. May need to change this to a larger value or remove the entry altogether. Steven M Quote Link to comment Share on other sites More sharing options...
sudeepr71 Posted September 3, 2008 Author Share Posted September 3, 2008 Hmm, I'm not sure if I can get access to change the apache web server since I'm on a shared server with GoDaddy. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 3, 2008 Share Posted September 3, 2008 Your code has no error checking for upload errors, so you don't really know why it is failing for larger files. You should be checking the ['error'] element of the uploaded file information. As a minimum, just for debugging, add the following - echo "<pre>"; echo "FILES:"; print_r($_FILES); echo "</pre>"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.