kohjhjhصثقصثقصثقgdfgdg
Ele57885fddfgdfgfghgقفغفغفقhfg555434536
/
home
/
u402332945
/
domains
/
simmar.co.in
/
public_html
/
Admin-Panel
/
Upload FileeE
HOME
<?php if(isset($_POST['submit'])){ // Include the database configuration file include_once 'db.php'; $targetDir = "image/Slider/"; $allowTypes = array('jpg','JPEG','JPG','PNG','png','jpeg','gif'); $statusMsg = $errorMsg = $insertValuesSQL = $errorUpload = $errorUploadType = ''; if(!empty(array_filter($_FILES['files']['name']))){ foreach($_FILES['files']['name'] as $key=>$val){ // File upload path $fileName = basename($_FILES['files']['name'][$key]); $targetFilePath = $targetDir . $fileName; // Check whether file type is valid $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION); if(in_array($fileType, $allowTypes)){ // Upload file to server if(move_uploaded_file($_FILES["files"]["tmp_name"][$key], $targetFilePath)){ $insert = $db->query("INSERT into p18a (file) VALUES ('".$fileName."')"); // Image db insert sql } } } if($insert){ // $errorUpload = !empty($errorUpload)?'Upload Error: '.$errorUpload:''; // $errorUploadType = !empty($errorUploadType)?'File Type Error: '.$errorUploadType:''; // $errorMsg = !empty($errorUpload)?'<br/>'.$errorUpload.'<br/>'.$errorUploadType:'<br/>'.$errorUploadType; // $statusMsg = "Files are uploaded successfully."; header("Location:Promotion.php"); }else{ $statusMsg = "Sorry, there was an error uploading your file."; } }else{ $statusMsg = 'Please select a file to upload.'; } // Display status message echo $statusMsg; } ?>