You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//This is the Specify interlink handler. Specify POSTs to this file to upload it's data.
$FILES_FOLDER = "files/"; // should end with slash
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
http_response_code(400);
echo "You must post!";
return;
}
if ($_SERVER["CONTENT_TYPE"] !== "application/json") {
http_response_code(400);
echo "You must use application/json";
return;
}
// https://stackoverflow.com/a/8945912
$raw_data = file_get_contents("php://input");
$json_data = json_decode($raw_data, true);
// https://stackoverflow.com/a/6041773/11585384
if (json_last_error() !== JSON_ERROR_NONE) {
http_response_code(400);
echo "Invalid JSON data!";
return;
}
//In this upload method, we take two strings from inside the file itself, combine them, hash them into md5 and then trim them to the 8th character to assign a random