rondog Posted October 17, 2008 Share Posted October 17, 2008 I am trying to upload a 29mb file. I am using this code which works fine with smaller files: if(isset($_POST['add'])) { $lastPosition = mysql_query("SELECT position from $table ORDER BY position DESC LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($lastPosition); $newPosition = (int)$row['position'] + 1; $title = addslashes($_POST['title']); $flv = strtolower( str_replace( " ", "_", basename( $_FILES['flv']['name'] ) ) ); $flvPathUL = "../".$flvPath."/".$flv; $move = move_uploaded_file($_FILES['flv']['tmp_name'], $flvPathUL); if($move) { $sql = mysql_query("INSERT INTO $table (position,title,src,thumbnail,type) VALUES ('$newPosition','$title','$flvPath/$flv','null','flv')") or die(mysql_error()); if($sql) { $status = "Video Successfully added!"; } else { $status = "Failed inserting Video Into Database. Please check your config and make sure you table name is correct."; } } else { $status = "Failed to upload FLV. Please check your config and make sure your folder names are right. Also make sure the folders have 777 permissions."; } } I was thinking that I just needed a max_file_size hidden field, but that didnt fix it. This is equivalent to 200mb <input type="hidden" name="MAX_FILE_SIZE" value="209715200" /> I am thinking its maybe timing out because none of those $status strings are being echoed once the page refreshes. Any idea why? Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 17, 2008 Share Posted October 17, 2008 post_max_size integer Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET['processed'] is set. If both the $_POST and $_FILES arrays are empty, the upload exceeds the post_max_size setting. However, your code is not checking the $_FILES['flv']['error'] element, so there could be a different problem occurring - http://us3.php.net/manual/en/features.file-upload.errors.php Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667742 Share on other sites More sharing options...
rondog Posted October 17, 2008 Author Share Posted October 17, 2008 I added a: echo $_FILES['flv']['error']; right before my if($move) and still got nothing. How would I check that? Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667746 Share on other sites More sharing options...
apulmca2k4 Posted October 17, 2008 Share Posted October 17, 2008 Yes, I can do it. contact on [email protected] Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667748 Share on other sites More sharing options...
rondog Posted October 17, 2008 Author Share Posted October 17, 2008 Umm....bot? Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667751 Share on other sites More sharing options...
PFMaBiSmAd Posted October 17, 2008 Share Posted October 17, 2008 The $_POST array will be empty as well, so $_POST['add'] won't be set in your code and none of your code inside of the if() block will be executed. You would need to put any check first in your code. The normal way (in addition to using a GET value on the end of the URL that the php manual mentioned) is to check if $_SERVER['REQUEST_METHOD'] is 'POST', meaning a POST form requested the page and then to test if the $_POST array and/or $_FILES array is empty. Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667758 Share on other sites More sharing options...
rondog Posted October 17, 2008 Author Share Posted October 17, 2008 Ok I checked phpinfo(); post_max_size 8M 8M upload_max_filesize 20M 20M That is obviously my problem. Now I just need access to my php.ini file..Damn shared host accounts! I remember 1and1 having an option somewhere that gives you access to your php.ini file..the phpinfo says its located at /usr/lib/php5/php.ini but I have no access to that folder through my ftp..hmmmm Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667762 Share on other sites More sharing options...
PFMaBiSmAd Posted October 17, 2008 Share Posted October 17, 2008 Even after you manage to change the setting, your code still needs to check for this condition, because sooner or later someone will attempt to upload a file large enough to exceed the setting and do you want them to be greeted with a blank web page when they do? Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667767 Share on other sites More sharing options...
rondog Posted October 17, 2008 Author Share Posted October 17, 2008 Yes, you are right. I managed to change the settings. I made a php.ini and only changed those directives and uploaded that to my server and according to phpinfo it is now 35m limit Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667768 Share on other sites More sharing options...
rondog Posted October 17, 2008 Author Share Posted October 17, 2008 Well crap doing that still didnt work hmmmm Going back to error checking..would this be correct sp far? if($_SERVER['REQUEST_METHOD'] == "POST") { if($_POST != empty) { if(isset($_POST['add'])) { $lastPosition = mysql_query("SELECT position from $table ORDER BY position DESC LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($lastPosition); $newPosition = (int)$row['position'] + 1; $title = addslashes($_POST['title']); $flv = strtolower( str_replace( " ", "_", basename( $_FILES['flv']['name'] ) ) ); $flvPathUL = "../".$flvPath."/".$flv; $move = move_uploaded_file($_FILES['flv']['tmp_name'], $flvPathUL); echo $_FILES['flv']['error']; if($move) { $sql = mysql_query("INSERT INTO $table (position,title,src,thumbnail,type) VALUES ('$newPosition','$title','$flvPath/$flv','null','flv')") or die(mysql_error()); if($sql) { $status = "Video Successfully added!"; } else { $status = "Failed inserting Video Into Database. Please check your config and make sure you table name is correct."; } } else { $status = "Failed to upload FLV. Please check your config and make sure your folder names are right. Also make sure the folders have 777 permissions."; } } } } Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667771 Share on other sites More sharing options...
rondog Posted October 17, 2008 Author Share Posted October 17, 2008 here is the faq I read about making the php.ini. http://faq.1and1.com/scripting_languages_supported/php/14.html It says it must be placed in every folder I want the changes to apply. I have it on my root which is not where my form is so Ill give it another go Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667773 Share on other sites More sharing options...
rondog Posted October 17, 2008 Author Share Posted October 17, 2008 Ahh ok good news! I just had to move the php.ini file into the directory with my form! Its working now, but I want to get this error check down, but I am not sure I am doing it correctly. What do you think? Link to comment https://forums.phpfreaks.com/topic/128800-getting-no-result-when-uploading-large-file/#findComment-667775 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.