1
2<?php
3if(isset($_POST['btn-upload']))
4{
5
6 $file = rand(1000,100000)."-".$_FILES['file']['name'];
7 $file_loc = $_FILES['file']['tmp_name'];
8 $file_size = $_FILES['file']['size'];
9 $file_type = $_FILES['file']['type'];
10 $folder="uploads/";
11
12 move_uploaded_file($file_loc,$folder.$file);
13 $sql="INSERT INTO tbl_uploads(file,type,size) VALUES('$file','$file_type','$file_size')";
14 mysql_query($sql);
15}
16?>