-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileUpload.php
49 lines (41 loc) · 1.26 KB
/
fileUpload.php
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
<?php
require_once("functions.php");
session_start();
header('Content-Type: text/html; charset=utf-8');
global $CLIENT_ID, $CLIENT_SECRET, $REDIRECT_URI;
$client = new Google_Client();
$client->setClientId($CLIENT_ID);
$client->setClientSecret($CLIENT_SECRET);
$client->setRedirectUri($REDIRECT_URI);
$client->setScopes('email');
$authUrl = $client->createAuthUrl();
getCredentials($_GET['code'], $authUrl);
$userName = $_SESSION["userInfo"]["name"];
$userEmail = $_SESSION["userInfo"]["email"];
?>
<!DOCTYPE html>
<html lang="fi">
<head>
<title>Logged in</title>
<meta charset="UTF-8">
</head>
<body>
Hello <? echo $userName; ?>!
<br>
<? echo $userEmail; ?>
<br><br><br>
<form enctype="multipart/form-data" action="formAction.php" method="POST">
<input type="file" name="file" required>
<br><br>
<label for="folderName">Folder name, this either uploads file to an existing folder or creates a new one based on the name</label>
<br>
<input type="text" name="folderName" placeholder="My cat Whiskers">
<br><br>
<label for="folderDesc">Folder description metadata, optional</label>
<br>
<input type="text" name="folderDesc" placeholder="Pictures of my cat">
<br><br>
<input type="submit" name="submit" value="Upload to Drive">
</form>
</body>
</html>