Note that there are some explanatory texts on larger screens.

plurals
  1. POFile upload limited to 1MB?
    text
    copied!<p>I can't understand why my server isn't accepting files larger than 1MB. I am using cpanel and my host has told me that I can't edit my php.ini file directly.</p> <p>My upload code:</p> <p></p> <pre><code>&lt;?php if (array_key_exists('uploadfile', $_POST)) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if (!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } mysql_query("INSERT INTO tbl_vehiclefiles (`veh_id`,`name`,`type`,`size`,`content`) VALUES ('$veh_id', '$fileName', '$fileType', '$fileSize','$content')"); echo '&lt;b&gt;File Upload&lt;/b&gt;&lt;p&gt;Thank you. The file has been successfully uploaded. &lt;p&gt;&lt;img src="resources/spacer.gif" alt="" width="300px" height="5px" /&gt;&lt;p&gt;&lt;o&gt; &lt;i&gt;&lt;u&gt;Name:&lt;/u&gt;&amp;nbsp;' . $fileName . '&lt;p&gt;&lt;i&gt;&lt;u&gt;Size:&lt;/u&gt;&amp;nbsp;' . $fileSize . 'k' . '&lt;p&gt;&lt;u&gt;Type:&lt;/u&gt;&amp;nbsp;' . $fileType . '&lt;/i&gt;&lt;p&gt;&lt;p&gt;&lt;img src="resources/spacer.gif" alt="" width="300px" height="5px" /&gt;'; $file_id = mysql_insert_id(); echo "&lt;/i&gt;&lt;p&gt;&lt;a href='managevehicle.php?id=$veh_id' class='form'&gt;Manage details&lt;/a&gt;&lt;p&gt; &lt;a href='viewfile2.php?id=$file_id' class='form'&gt;View details&lt;/a&gt;&lt;p&gt;"; exit; } ?&gt; &lt;b&gt;File Upload&lt;/b&gt;&lt;/p&gt; &lt;p&gt; &lt;input type="hidden" name="MAX_FILE_SIZE" value="200000000"&gt; &lt;span id="sprytextfield1"&gt; &lt;input name="userfile" type="file" id="userfile"&gt; &lt;/span&gt;&lt;BR /&gt; &lt;input type="hidden" name="uploadfile" value="1"/&gt; &lt;input name="upload" type="submit" id="upload" value=" Upload "&gt; &lt;/p&gt; </code></pre> <p>I was told that I could create my own php.ini file and save it on cpanel file manager to override some of the php.ini values. This is what I have on it at the moment:</p> <pre><code>//Common local changes: upload_max_filesize = 20M; // (default 8 - Max, 32) post_max_size = 20M; // (Average, 20 - Max, 32) register_globals = Off; // (off by default - you can turn On) allow_url_fopen = On; // (off by default - you can turn to On) memory_limit = 24M; // (default of 8M, Max 32) </code></pre> <p>but it has no effect! Any suggestions?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload