HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/amazons3/index2.php
<?php
	if(isset($_FILES['image'])){
		$file_name = $_FILES['image']['name'];
		$temp_file_location = $_FILES['image']['tmp_name'];

		$target_dir = "uploads/";
		$target_file = $target_dir . basename($_FILES["image"]["name"]);
		$uploadOk = 1;
		$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
		// Check if image file is a actual image or fake image
		 
			$check = getimagesize($_FILES["image"]["tmp_name"]);

			 print_r($check);
			if($check !== false) {
				 
				$uploadOk = 1;
			} else {
				echo "<center>File is not an image.</center>";
				$uploadOk = 0;
			}
			$uploadOk = 1;
		 
		// Check if file already exists
		 
		// Check file size
		 
		// Allow certain file formats
		 
		// Check if $uploadOk is set to 0 by an error
		if ($uploadOk == 0) {
			echo "<center>Sorry, your file was not uploaded.</center>";
		// if everything is ok, try to upload file
		} else {
			if (move_uploaded_file($_FILES["image"]["tmp_name"], $target_file)) {
				echo "<center><i><h4>The file ". basename( $_FILES["image"]["name"]). " has been uploaded.</h4></i></center>";
			} else {
				echo "<center>Sorry, there was an error uploading your file.</font></center>";
			}
		}
	
	}
?>

<form action="<?= $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
	<input type="file" name="image" />
	<input name="submit" type="submit"/>
</form>