* * Description: * * Upload successful & File accepted by server. * status = 'success' * message = * * Upload failed: * status = 'error' * message = */ $answer = array(); $answer[API_STATUS] = API_ANSWER_STATUS_ERROR; $answer[API_MESSAGE] = ''; try { try { $fileUpload = new File(); $fileUpload->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 (\Exception $e) { $answer[API_MESSAGE] = "Generic Exception: " . $e->getMessage(); } header("Content-Type: application/json"); echo json_encode($answer);