Guernica Posted October 4, 2007 Share Posted October 4, 2007 Here is the full code: // Run the shit... if($filesize > $_POST['MAX_FILE_SIZE']) { print_r($_FILES); die('The file you attempted to upload is too big!'); } if(!in_array($ext,$allowed_filetypes)) { print_r($_FILES); die('The file you attempted to upload is not allowed.'); } // If it is moved successfully, woot! if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path . $filename)) { echo "<font color='green'>The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded successfully!</font><br/>"; echo "<b>File Size:</b> {$displaysize} KB <br/>"; echo "<b>File Name:</b> {$_FILES['uploadedfile']['name']} <br/>"; // Check for password. if(empty($_POST['filepass'])) { echo "<p><i>No password specified.</i></p>"; } else { $filepassed = $_POST['filepass']; echo "<p><i>File has been passworded successfully!</i></p>"; } mysql_query("INSERT INTO files (username, filename, password, filesize, dllink) VALUES('$username', '$filename', '$filepassed', '$filesize', '$downloadlink') ") or die(mysql_error()); } else { print_r($_FILES); die('There was an error uploading the file, please try again!'); } } (Variables set above) This is the error I get when uploading a file like, over 500kb or something: Array ( [uploadedfile] => Array ( [name] => FileADB_CS2.zip [type] => [tmp_name] => [error] => 1 => 0 ) ) There was an error uploading the file, please try again! I have tried many things. One guy said it was probably the server max file size set by the server (php.ini). I asked my host, they said it was set to 2500MB which is what it says in my CPanel. I even took the filesize checking code OUT and still same thing. I need some help here. Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/ Share on other sites More sharing options...
jscix Posted October 4, 2007 Share Posted October 4, 2007 if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path . $filename)) { what are the $target_path and $filename variables? Does the upload folder have permissions? Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/#findComment-361340 Share on other sites More sharing options...
Guernica Posted October 4, 2007 Author Share Posted October 4, 2007 My variables: $allowed_filetypes = array('.jpg','.gif','.bmp','.png','.rar','.zip','.doc','.mp3','.mpeg','.avi'); $max_filesize = $_POST['MAX_FILE_SIZE']; $username = $_SESSION['username']; $filename = ((int)rand(0,50)) . ($_FILES['uploadedfile']['name']); $filesize = $_FILES['uploadedfile']['size']; $displaysize = $_FILES['uploadedfile']['size'] / 100; $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); $target_path = "/home/myoosicn/public_html/upload/files/"; $_FILES['uploadedfile']['tmp_name']; $folder = "http://upload.myoosic.net/download.php?file="; $downloadlink = $folder . $filename; The folder is CHMOD to 777 yes. Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/#findComment-361345 Share on other sites More sharing options...
jscix Posted October 4, 2007 Share Posted October 4, 2007 Hrm.. I would try FTPing into the temp directory and watch as the file is uploaded. Try a larger file so you can check the file size periodically, if all is well during the upload, then either the file is being removed before the script can move it, or their is a file path, or permissions error somewhere. Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/#findComment-361350 Share on other sites More sharing options...
Guernica Posted October 4, 2007 Author Share Posted October 4, 2007 Temp. folder being the files folder? Or some special folder? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/#findComment-361351 Share on other sites More sharing options...
jscix Posted October 4, 2007 Share Posted October 4, 2007 generally when you upload through a script, the file is stored in a temporary folder, then moved to a perm. folder, after which the file in the tmp folder is deleted Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/#findComment-361353 Share on other sites More sharing options...
Guernica Posted October 4, 2007 Author Share Posted October 4, 2007 I have a 'tmp' folder outside the public_html. That just has analog or awstats folders, webalizer, etc. Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/#findComment-361356 Share on other sites More sharing options...
Guernica Posted October 4, 2007 Author Share Posted October 4, 2007 I uploaded a large file to my FTP in the tmp folder and it uploaded perfectly fine. Thanks for any help/suggestions! Quote Link to comment https://forums.phpfreaks.com/topic/71752-error-1-size-0-uploading/#findComment-361942 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.