file.php 812 Bytes
Newer Older
Carsten  Rose's avatar
Carsten Rose committed
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
<?php
/**
 * Created by PhpStorm.
 * User: crose
 * Date: 4/25/16
 * Time: 8:02 PM
 */

$answer = array();

$answer[API_MESSAGE] = '';
$answer[API_STATUS] = API_ANSWER_STATUS_ERROR;

try {

    $upload = new \qfq\File();

    $upload->process();

    $answer[API_MESSAGE] = 'upload: success';
    $answer[API_REDIRECT] = API_ANSWER_REDIRECT_NO;
    $answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;

} catch (qfq\UserFormException $e) {
    $answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\CodeException $e) {
    $answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
    $answer[API_MESSAGE] = $e->formatMessage();
} catch (\Exception $e) {
    $answer[API_MESSAGE] = "Generic Exception: " . $e->getMessage();
}

header("Content-Type: application/json");
echo json_encode($answer);