-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUploadImage.php
More file actions
21 lines (19 loc) · 1014 Bytes
/
UploadImage.php
File metadata and controls
21 lines (19 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?
extract($_POST);
$UploadedFileName=$_FILES['UploadImage']['name'];
if($UploadedFileName!='')
{
$upload_directory = "MyUploadImages/"; //This is the folder which you created just now
$TargetPath=time().$UploadedFileName;
if(move_uploaded_file($_FILES['files']['tmp_name'], $upload_directory.$TargetPath))
{
$QueryInsertFile="INSERT INTO user SET picture='$TargetPath'";
// Write Mysql Query Here to insert this $QueryInsertFile.
$link = mysqli_connect("localhost", "root", "Thisistheultimatepassword1337", "mydb") or die ("Connection Error " . mysqli_error($link));
if ($stmt = mysqli_prepare($link, $QueryInsertFile)) {
mysqli_stmt_bind_param($stmt, "s", $QueryInsertFile) or die ("photobind");
header('Location: /register.php');
}
}
}
?>