Viewing file: upload.php (1.51 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include('class.uploader.php'); include('../config.php'); error_reporting(0); if(isset($_FILES['images']['name'])): define ("MAX_SIZE","2000"); for($i=0; $i<count($_FILES['images']['name']); $i++) { $size=filesize($_FILES['images']['tmp_name'][$i]); if($size < (MAX_SIZE*1024)): $path = "uploads/"; $name = $_FILES['images']['name'][$i]; $size = $_FILES['images']['size'][$i]; list($txt, $ext) = explode(".", $name); date_default_timezone_set ("Asia/Calcutta"); $currentdate=date("d M Y"); $file= time().substr(str_replace(" ", "_", $txt), 0); $info = pathinfo($file); $filename = $file.".".$ext; $v_title =$_POST['title']; if(move_uploaded_file($_FILES['images']['tmp_name'][$i], $path.$filename)) : $fetch=$db->query("INSERT INTO tbl_image(image_name,title) VALUES('$filename','$v_title')"); if($fetch): header('Location:index1.php'); else : $error ='Data not inserting'; endif; else : $error = 'File moving unsuccessful'; endif; else: $error = 'You have exceeded the size limit!'; endif; } else: $error = 'File not found!'; endif; ?> <h2><?php echo @$error ?></h2> <a href="index.php">Try Again</a> <?php function onFilesRemoveCallback($removed_files){ foreach($removed_files as $key=>$value){ $file = '../uploads/' . $value; if(file_exists($file)){ unlink($file); } } return $removed_files; } ?>
|