$command = "curl -X POST $url".
" -H 'accept: application/json'".
" -H 'Content-Type: multipart/form-data'".
" -F 'file=@$filePath'";
echo $response = shell_exec($command);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
$file = curl_file_create($filePath);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => $file,
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $response = curl_exec($ch);
#!/bin/bash
DETAILS=$1
TYPE_FILE=$2
FILE=$3
TYPE=$4
curl -X 'POST' \
'https://IP_СЕРВЕРА/file/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F "file=@1.png"
curl -X 'POST' 'http://IP_СЕРВЕРА/file/upload' -H 'accept: application/json' -H 'Content-Type: multipart/form-data' -F 'file=@1.png'
PHP-файл ещё в браузере