0

I try to upload a file using PHP, when the file is not big enough everything goes well, but when the file reaches a little 15Mo I have an error message that appears ! Here is some of the code used for the upload

<form action="upload.php" method="post" enctype="multipart/form-data">
     <div class="form-group">
          <div class="btn btn-default btn-file">
             <i class="fa fa-paperclip"></i> Attachment
          <input type="file" name="fileToUpload" id="fileToUpload">
     </div>

This is where I have the problem:

$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

1 Answers1

0

You have to increase your file upload as well as post limit.

; Maximum allowed size for uploaded files.
upload_max_filesize = 50M

; Must be greater than or equal to upload_max_filesize
post_max_size = 50M

You can use ini_set method as below.

ini_set('post_max_size', '50M');
ini_set('upload_max_filesize', '50M');

More Deatils

Community
  • 1
  • 1
TIGER
  • 2,864
  • 5
  • 35
  • 45