-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.php
More file actions
36 lines (27 loc) · 728 Bytes
/
upload.php
File metadata and controls
36 lines (27 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/* mysql_connect("localhost","root","");
mysql_select_db("file"); */
include 'css/connection.php';
if(isset($_REQUEST["submit"]))
{
$file=$_FILES["file"]["name"];
$tmp_name=$_FILES["file"]["tmp_name"];
echo $tmp_name ;
echo "<br>";
echo $file;
$path="upload/".$file;
$file1=explode(".",$file);
$ext=$file1[1];
$allowed=array("jpg","png","gif","pdf","wmv","pdf","zip");
if(in_array($ext,$allowed))
{
move_uploaded_file($tmp_name,$path);
$sql= "INSERT INTO upload(file)values('$file')";
$result = mysqli_query($conn,$sql);
}
}
?>
<form enctype="multipart/form-data" method="post">
Add screenshot<input type="file" name="file">
<input type="submit" name="submit" value="upload">
</form>