0

So I've changed all these values in php.ini:

Max file upload size = 10000M

post upload size = 11000M

Excecution Max Time = 12000

Input Max Time = 12000

Im also using a PHP form which uploads multiple files at once: index.php (file upload form, other code on page which requires php backend)

 <input type="hidden" value="form" name="<?php echo ini_get('session.upload_progress.name'); ?>">
    <div class="upload-btn-wrapper">
      <button class="btn">Drag File / Click to upload</button>

      <input type="file" name="files[]" multiple="multiple" id="fileToUpload">
    </div>

</form>
  document.getElementById("fileToUpload").onchange = function() {
      startUpload();
      setTimeout(function(){document.getElementById("form").submit();}, 1000);
}


</script>

Again, I can upload normal files fine, but large files dont work. heres the file upload php code:

<?php
session_start();
//boi

$max_file_size = 20000000; //2GB
$path = $_SESSION["directory"]."/"; // Upload directory
$count = 0;

if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST"){
    // Loop $_FILES to exeicute all files
    foreach ($_FILES['files']['name'] as $f => $name) {
        if ($_FILES['files']['error'][$f] == 4) {
            continue; // Skip file if any error found
        }
        if ($_FILES['files']['error'][$f] == 0) {
            if ($_FILES['files']['size'][$f] > $max_file_size) {
                $message[] = "$name is too large!.";
                continue; // Skip large files
            }
            else{ // No error found! Move uploaded files
                if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path.$name))
                    $count++; // Number of successfully uploaded file
            }
        }
    }
}
    header("location: index.php");
?>

the site this is live on is: http://simpledrive.duckdns.org/simple

thanks.

  • you have it to change in your php.ini file. Because theyset there also a limit PS its 25MB there – xmaster May 07 '19 at 08:21
  • Could it be a webserver restriction? – Daan May 07 '19 at 08:21
  • @xmastertje What value do i need to change in the php.ini exactly. – AngusClayto May 07 '19 at 08:23
  • @Daan Im running it on apache2, on Raspberry pi 2b+, raspbian lite. (1Gb RAM, 4 core 1ghz debian based u know) thanks for the help. – AngusClayto May 07 '19 at 08:24
  • Possible duplicate of [Change the maximum upload file size](https://stackoverflow.com/questions/2184513/change-the-maximum-upload-file-size) – xmaster May 07 '19 at 08:57
  • change your .htaccess – xmaster May 07 '19 at 08:58
  • @xmastertje I have done so, http acess i edited is this: /etc/apache2/sites-enabled/000-defult.conf: code i pasted at bottom of file is this: php_value upload_max_filesize 106969M php_value post_max_size 116969M – AngusClayto May 07 '19 at 09:36
  • Realised thats not httpacess. So i made a .htacess file in same directory as upload php and uploadForm.php files. and pasted in: php_value upload_max_filesize 10240M php_value post_max_size 10240M – AngusClayto May 07 '19 at 09:53

1 Answers1

0

Time for me to answer my own question, So turns out it was a couple lines of code in the upload script I had written/coppied from all over the place.

$max_file_size = 20000000;
if ($_FILES['files']['size'][$f] > $max_file_size) {

Turns out the ['files']['size'][$f] here was massivley larger than $max_file_size. even set at 20000000.

Thanks for your help anyway guys.

to be honest, im kinda retarted (meme image)