0

i need help finding out why i cant upload images of higher size

<?php
//This code shows how to Upload And Insert Image Into Mysql Database       Using  Php Html.
//connecting to uploadFile database.
$conn = mysqli_connect("localhost", "root", "", "aquacool_db");
if($conn) {
//if connection has been established display connected.
echo "connected";
 }
 //if button with the name uploadfilesub has been clicked
 if(isset($_POST['uploadfilesub'])) {
 //declaring variables
 $filename = $_FILES['uploadfile']['name'];
 $filetmpname = $_FILES['uploadfile']['tmp_name'];
 //folder where images will be uploaded
 $folder = $_POST['folder'];
 //function for saving the uploaded images in a specific folder
 move_uploaded_file($filetmpname, $folder.$filename);
 //inserting image details (ie image name) in the database

$path = ''.$folder.''.$filename.'';

$sql = "INSERT INTO `uploadedimage` (`imagename`)  VALUES ('$path')";
if( $qry) {
echo "</br>image uploaded</br>"; 
echo $path;

}

}

?>

 <!DOCTYPE html>
 <html>
 <body>
<!--Make sure to put "enctype="multipart/form-data" inside form tag when     uploading files -->
<form action="" method="post" enctype="multipart/form-data" >
<!--input tag for file types should have a "type" attribute with value      "file"-->
 <input type="text" name="folder" />
 <input type="file" name="uploadfile" />
 <input type="submit" name="uploadfilesub" value="upload" />
 </form>
 </body>
 </html>

i need help finding out why i cant upload images of higher size

  • 1
    Possible duplicate of [Change the maximum upload file size](https://stackoverflow.com/questions/2184513/change-the-maximum-upload-file-size) – catcon Aug 14 '19 at 01:31

1 Answers1

1

edit php.ini

upload_max_filesize = 50M
post_max_size = 200M

; if needed
memory_limit = 512M
max_execution_time = 600
max_input_time = 600

edit Apahce (if needed)

LimitRequestBody 10485760

(10M=10*1024*1024=10485760)