From 1411bce1dc13bf6fea66b5899ba29d50d5c53bb0 Mon Sep 17 00:00:00 2001 From: pantsucat Date: Thu, 17 Sep 2015 23:12:51 +1000 Subject: Add html response class --- static/upload.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'static/upload.php') diff --git a/static/upload.php b/static/upload.php index 4dc45a3..21ae386 100644 --- a/static/upload.php +++ b/static/upload.php @@ -93,7 +93,6 @@ function upload_file($file) $result = $q->fetch(); if ($result['count'] > 0) { unlink($file->tempfile); - return array( 'hash' => $file->get_sha1(), 'name' => $file->name, @@ -132,11 +131,10 @@ function upload_file($file) $q->bindValue(':exp', null, PDO::PARAM_STR); $q->bindValue(':del', sha1($file->tempfile), PDO::PARAM_STR); $q->execute(); - return array( 'hash' => $file->get_sha1(), 'name' => $file->name, - 'url' => POMF_URL.$newname, + 'url' => $newname, 'size' => $file->size, ); } else { @@ -196,6 +194,7 @@ function refiles($files) } $type = isset($_GET['output']) ? $_GET['output'] : 'json'; + $response = new Response($type); if (isset($_FILES['files'])) { @@ -212,3 +211,5 @@ if (isset($_FILES['files'])) { } else { $response->error(400, 'No input file(s)'); } + + -- cgit v1.2.3