Sh3ll
OdayForums


Server : Apache
System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 8.0.28
Disable Function : NONE
Directory :  /var/www/html/mmishra/erp-21-08-2019/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/mmishra/erp-21-08-2019/includes/erp_upload.inc
<?php

// Check if image file is a actual image or fake image
$returnURL = "";
if ($_POST['submit'] == 'UPLOAD') {
	$returnURL 		= $_POST["returnURL"];
	$tuple 			= $_POST["tuple"];
	$docID			= $_POST["docID"];
	$docCode		= $_POST["docCode"];
	$sourceFile		= basename($_FILES["fileToUpload"]["name"]);
	$uploadFile		= $ID. '-' .$certCode. '-' .$sourceFile;
	$targetFile 	= __DIR__. "/../uploads/" .$uploadFile;
	$extName	 	= strtolower(pathinfo(basename($_FILES["fileToUpload"]["name"]), PATHINFO_EXTENSION));
	
   	$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
   	if ($check !== false) {
       	//$mm = "File is an image - " . $check["mime"] . ".";
		// Check if file already exists
		if (file_exists($targetFile)) {
    		$mm = "Sorry, " .$sourceFile. " file already exists.";
		// Check file size
		} else if ($_FILES["fileToUpload"]["size"] > 900000) {
    		$mm = "Sorry, " .$sourceFile. " file is too large.";
		// Allow certain file formats
		} else if ($extName == "jpg" && $extName == "png" && $extName == "jpeg" && $extName == "gif") {
    		$mm = "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
		// if everything is ok, try to upload file
		} else if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $targetFile)) {
        		$mm = basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    	} else {
        	$mm = "Sorry, there was an error uploading " .$sourceFile;
    	}
    	
    } else {
        $mm = $sourceFile. " is not an image.";
    }
} else {
	$mm = "nothing to show.";
}
$mm .= "<br><br>
Go back <a href='' onclick=\"inner('" .$returnURL. "&certCode=" .$certCode. "&fileName=" .$upFile. "'); return false;\" title='More upload'><span class='button'><i class='fas fa-undo-alt'></i></span> </a> for more upload. &nbsp;&nbsp;";
//header("Location: " .$returnURL);
$mm .= " [" .$returnURL. "&fileName=" .$upFile. "]";
?>

ZeroDay Forums Mini