Fix upload file (API)

This commit is contained in:
Thomas Zilio 2018-08-20 13:09:27 +02:00
parent 6f4a12a85a
commit 1ba712c1c8
2 changed files with 8 additions and 5 deletions

View File

@ -7,10 +7,10 @@ switch ($resource) {
$upload = Uploads::upload($_FILES['upload'], [
'name' => $request['name'],
'id_module' => $module['id'],
'id_record' => $id_record,
'id_record' => $request['id'],
]);
$results['filename'] = $upload;
$response['filename'] = $upload;
break;
}

View File

@ -1,6 +1,5 @@
<?php
/**
* Classe per la gestione delle API del progetto.
*
@ -376,6 +375,10 @@ class API extends \Util\Singleton
/**
* Restituisce i parametri specificati dalla richiesta.
*
* @param bool $raw
*
* @return array
*/
public static function getRequest($raw = false)
{
@ -388,8 +391,8 @@ class API extends \Util\Singleton
$request = (array) json_decode($request, true);
$request = Filter::sanitize($request);
// Fallback nel caso la richiesta sia effettuata da browser
if ($_SERVER['REQUEST_METHOD'] == 'GET' && empty($request)) {
// Fallback per input standard vuoto (richiesta da browser o upload file)
if (empty($request)) { // $_SERVER['REQUEST_METHOD'] == 'GET'
$request = Filter::getGET();
}