Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'conn.php';
- if(ISSET($_FILES['file']['name'][0])){
- foreach($_FILES['file']['name'] as $key => $values){
- $file = explode(".", $values);
- $ext = array("png", "gif", "jpg", "jpeg");
- if(in_array($file[1], $ext)){
- $file_name = $file[0].'.'.$file[1];
- $tmp_file = $_FILES['file']['tmp_name'][$key];
- $location = "upload/".$file_name;
- if(move_uploaded_file($tmp_file, $location)){
- $conn->query("INSERT INTO `upload` VALUES('', '$file_name', '$location')");
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment