Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/buildyourownbotnet/data/upload-file.php
1292 views
1
<?php
2
3
header('Content-Type: application/json');
4
5
$errors = mt_rand(0,100)%2==0; // Random response (Demo Purpose)
6
7
8
$resp = array(
9
);
10
11
# Normal Response Code
12
if(function_exists('http_response_code'))
13
http_response_code(200);
14
15
16
# On Error
17
if($errors)
18
{
19
if(function_exists('http_response_code'))
20
http_response_code(400);
21
22
$resp['error'] = "Couldn't upload file, reason: ~";
23
}
24
25
echo json_encode($resp);
26