-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuploadproject.php
More file actions
55 lines (47 loc) · 1.4 KB
/
uploadproject.php
File metadata and controls
55 lines (47 loc) · 1.4 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include 'dbconn.php';
$ptitle=$_POST['ptitle'];
$pmname=$_POST['pmname'];
$pmid=$_POST['pmid'];
$pmmobile=$_POST['pmmobile'];
$pmbranch=$_POST['pmbranch'];
$tlname=$_POST['tlname'];
$tlid=$_POST['tlid'];
$tlmobile=$_POST['tlmobile'];
$tlbranch=$_POST['tlbranch'];
$pdesc=$_POST['pdesc'];
$stdack=$_POST['stdack'];
$file=$_FILES['prfile'];
$fname=$_FILES['prfile']['name'];
$fsize=$_FILES['prfile']['size'];
$floc=$_FILES['prfile']['tmp_name'];
$ferror=$_FILES['prfile']['error'];
if($ferror === 0)
{
if($fsize < 50000000)
{
$fextr=explode('.',$fname);
$fext=strtolower(end($fextr));
$accepted_ext=array('zip','rar','7z');
if (in_array($fext,$accepted_ext)){
$fnewname=$tlid.'.'.$fext;
$fdest='uploadedfiles/'.$fnewname;
move_uploaded_file($floc,$fdest);
$sql="insert into projects (ptitle,pmname,pmid,pmmobile,pmbranch,stdname,stdid,stdmobile,stdbranch,pdesc,stdack) values ('$ptitle','$pmname','$pmid','$pmmobile','$pmbranch','$tlname','$tlid','$tlmobile','$tlbranch','$pdesc','$stdack');";
mysqli_query($conn,$sql);
header("Location: project.php?uploadsuccess");
}
else{
echo "Invalid file type";
}
}
else
{
echo "File size is $fsize. File size is too big. Upload file less than 50 mb";
}
}
else
{
echo "Error in uploading the file";
}
?>