File upload request

To upload a file to the server, you need to send POST data containing login, password, file variables. The response will be the id of the saved file, which you can later use in xml-requests.

File upload request

POST http://lk.mysmpp.ru/xml/file.php

Request Body

NameTypeDescription

login*

String

Your login in the system

file*

data

File to be sent

token*

String

You can use a secret key instead of login and password. To obtain it, please contact your manager

password*

String

Your password in the system

The id of the added file in the system will be returned

File upload example

$href = "http://lk.mysmpp.ru/xml/file.php"; 
// (example: $tmpfname = "C:\Program Files\file\test.jpg";)
$tmpfname = "name";
$requist['login'] = "login";
$requist['passsword'] = "passsword";
if(PHP_VERSION_ID <  56000)
    $requist['file'] = '@' . $tmpfname;
else
    $requist['file'] = new CurlFile($tmpfname, 'image/jpg');  
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $href);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requist);
$result = curl_exec($ch);
curl_close($ch);
 
echo $result;

Last updated