LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Cant upload a file bigger then 1mb with php (https://www.linuxquestions.org/questions/programming-9/cant-upload-a-file-bigger-then-1mb-with-php-171900/)

OrangeLefty 04-18-2004 11:44 PM

Cant upload a file bigger then 1mb with php
 
Hey again,

I just wrote a simple upload script and it wont let me upload a file bigger then 1 M. Internet explorer just says the page cannot be displayed, and a friend said he got a connection error of some sort.

Now i notice alot of peoples scripts have an HTML file seperate from the php file, i do not. Ill include the script at the end of this post.

My upload_max_filesize is 10M (exactly what it says) and my max_post_size is 8M. Memory limit is 20M, max_execution_time is 30, file_uploads is 1, and safe_mode is off. Everything seems to check out on the variable side, so any ideas?

PHP Code:

<?

        $readmefileTableSettings 
$mainTableSettings;
        
$readmefileTableSettings["header_colspan"] = 2;

        
$sql get_db_conn();
        
        
        if (
$upload_server) {
        
                
move_uploaded_file($_FILES['map']['tmp_name'],'/var/www/html/uploads/' $mod '/' $_FILES['map']['name']);
                
$mapfile $_FILES['map']['name'];
                        
$sql->Query("INSERT server SET name = '$mapfile', mod = '$mod', status =1");
                
$contents["header"] = "Success!";
                
$contents["main"] .= "The file was uploaded successfully and is now avalible on our server\n";
        
                
CreateBox($contents$readmefileTableSettings);
                
EndRow();
                
StartRow();
                           
        }

        
// construct the news contents
        
$contents["header"] = "Upload to Server";
        
$contents["main"]  = "\t\t\t\t<tr bgcolor='" $TABLECELL_BACKGROUND_COLOR "'>\n";
        
$contents["main"] .= "\t\t\t\t\t<td>Map&nbsp;</td>\n";
        
$contents["main"] .= "\t\t\t\t\t<td align='right'><form method='post' action='?mode=uploadserver&upload_server=1' enctype='multipart/form-data' ><input type='file' name='map'></td>\n";

        
$contents["main"] .= "\t\t\t\t<tr bgcolor='" $TABLECELL_BACKGROUND_COLOR "'>\n";
        
$contents["main"] .= "\t\t\t\t\t<td>Mod:</td>\n";
        
$contents["main"] .= "\t\t\t\t\t<td colspan=2 align='right'><input type='radio' name='mod' value='valve'>Valve HL\n";
        
$contents["main"] .= "\t\t\t\t\t<input type='radio' name='mod' value='cstrike'>Counter-Strike\n";
        
$contents["main"] .= "\t\t\t\t\t<input type='radio' name='mod' value='tfc'>TFC</td>\n";
        
$contents["main"] .= "\t\t\t\t</tr>\n";
        
        
$contents["main"] .= "\t\t\t\t<tr bgcolor='" $TABLECELL_BACKGROUND_COLOR "'>\n";
        
$contents["main"] .= "\t\t\t\t\t<td colspan=2 align='right'>Make sure you've read about this service, and that the server is mostly playing CS!</td>\n";
        
$contents["main"] .= "\t\t\t\t</tr>\n";

        
$contents["main"] .= "\t\t\t\t<tr bgcolor='" $TABLECELL_BACKGROUND_COLOR "'>\n";
        
$contents["main"] .= "\t\t\t\t\t<td colspan=2 align='right'><input type='submit' value='Upload'></form></td>\n";
        
$contents["main"] .= "\t\t\t\t</tr>\n";

        
CreateBox($contents$readmefileTableSettings);

        
$msg_tag = -10009;
?>


OrangeLefty 04-19-2004 01:54 AM

I found the problem.

In /etc/httpd/conf.d/php.conf

You have to edit [some value, i forgot the name] something about Limit. Its like right smack dap in the middle. Its set to 512kb. I think and admin should make a post about this, it can be a pain.


All times are GMT -5. The time now is 05:21 PM.