<?php
header("Content-type: application/json; charset=utf-8");
chdir('../..');
require_once('api/buyers.php');
$buyers = new Buyers();

if(!$buyers->sessions->admin)
{
    http_response_code(403);
    echo json_encode(['error' => 'Access denied']);
    exit;
}

if($filename = $buyers->request->get('filename'))
{
    $attach = $buyers->files->upload_file($filename);
    print json_encode($attach, JSON_UNESCAPED_UNICODE);
}
