Add support for file uploads

This commit is contained in:
Maurits van der Schee 2018-10-13 08:33:10 +02:00
commit 8bbc782b96
8 changed files with 62 additions and 13 deletions

View file

@ -2,7 +2,7 @@
<head>
<meta charset="utf-8" />
<script>
var authUrl = 'authorize.php'; // hostname ending in '.auth0.com'
var authUrl = 'auth.php'; // hostname ending in '.auth0.com'
var clientId = 'default'; // client id as defined in auth0
var audience = 'api.php'; // api audience as defined in auth0
window.onload = function () {

View file

@ -19,7 +19,7 @@ window.onload = function () {
document.getElementById('output').innerHTML = JSON.stringify(JSON.parse(req.responseText), undefined, 4);
}
}
url = 'http://127.0.0.3/api.php/records/posts?join=categories&join=tags&join=comments&filter=id,eq,1';
url = '/api.php/records/posts?join=categories&join=tags&join=comments&filter=id,eq,1';
req.open("GET", url, true);
req.setRequestHeader('X-Authorization', 'Bearer '+accessToken);
req.send();

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<body>
<form action="api.php/records/categories" method="post" enctype="multipart/form-data">
<input type="text" name="name" value="upload">
<input type="file" name="icon">
<input type="submit" value="upload">
</form>
</body>
</html>