G:
/
PleskVhosts
/
seeonsoft.com
/
hp.thefalconunited.com
/
up file
home
<?php include('config.php'); $pkgid = $_POST['pkgid']; $titleimg = 'title'; $mkfile = "upload/package/".$pkgid."/"; mkdir($mkfile, 0777, true); $uploadFileDir = $mkfile; $filesss = $_FILES['titleimage']['name']; $counst = count($filesss); for($i=0;$i<=$counst;$i++) { $fileTmpPath = $_FILES['titleimage']['tmp_name'][$i]; $fileName = $_FILES['titleimage']['name'][$i]; $fileSize = $_FILES['titleimage']['size'][$i]; $fileType = $_FILES['titleimage']['type'][$i]; $fileNameCmps = explode(".", $fileName); $fileExtension = strtolower(end($fileNameCmps)); echo $newFileName = $fileName; // check if file has one of the following extensions $allowedfileExtensions = array('jpg', 'jpeg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc', 'docx', 'pdf', 'xlsx', 'WebP', 'webp'); if (in_array($fileExtension, $allowedfileExtensions)) { // directory in which the uploaded file will be moved $dest_path = $uploadFileDir . $newFileName; if(move_uploaded_file($fileTmpPath, $dest_path)) { $message ='File is successfully uploaded.'; } else { $message = 'There was some error moving the file to upload directory. Please make sure the upload directory is writable by web server.'; } $sql1 = $js->prepare('INSERT INTO `packageimages` (`package`, `file`, `type`, `size`, `filetype`) VALUES (:pkgid, :newFileName, :fileExtension, :fileSize, :titleimg)'); $status1 = $sql1->execute(array(':pkgid' => $pkgid, ':newFileName' => $newFileName, ':fileExtension' => $fileExtension, ':fileSize' => $fileSize, ':titleimg' => $titleimg)); } else { $message = 'Upload failed. Allowed file types: ' . implode(',', $allowedfileExtensions); } echo $message; } $filess = $_FILES['uploadedFile']['name']; $count = count($filess); for($i=0;$i<=$count;$i++) { $fileTmpPath = $_FILES['uploadedFile']['tmp_name'][$i]; $fileName = $_FILES['uploadedFile']['name'][$i]; $fileSize = $_FILES['uploadedFile']['size'][$i]; $fileType = $_FILES['uploadedFile']['type'][$i]; $fileNameCmps = explode(".", $fileName); $fileExtension = strtolower(end($fileNameCmps)); echo $newFileName = $fileName; // check if file has one of the following extensions $allowedfileExtensions = array('jpg', 'jpeg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc', 'docx', 'pdf', 'xlsx', 'WebP', 'webp'); if (in_array($fileExtension, $allowedfileExtensions)) { // directory in which the uploaded file will be moved $dest_path = $uploadFileDir . $newFileName; if(move_uploaded_file($fileTmpPath, $dest_path)) { $message ='File is successfully uploaded.'; } else { $message = 'There was some error moving the file to upload directory. Please make sure the upload directory is writable by web server.'; } $sql1 = $js->prepare('INSERT INTO `packageimages` (`package`, `file`, `type`, `size`) VALUES (:pkgid, :newFileName, :fileExtension, :fileSize)'); $status1 = $sql1->execute(array(':pkgid' => $pkgid, ':newFileName' => $newFileName, ':fileExtension' => $fileExtension, ':fileSize' => $fileSize)); } else { $message = 'Upload failed. Allowed file types: ' . implode(',', $allowedfileExtensions); } //echo $message; } ?> <script type="text/javascript"> alert("Have Successfully Uploaded the images"); window.location = 'view_packages.php'; </script>