in ws_images_addSimple the $_FILES['image']['error'] is nicely interpreted and converted into a useful message. In ws_images_upload I request to have something similar. Maybe
if (isset($_FILES['file']['error']) && $_FILES['file']['error'] != 0)
{
switch($_FILES['file']['error'])
{
case UPLOAD_ERR_INI_SIZE:
$message = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
break;
case UPLOAD_ERR_FORM_SIZE:
$message = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
break;
case UPLOAD_ERR_PARTIAL:
$message = 'The uploaded file was only partially uploaded.';
break;
case UPLOAD_ERR_NO_FILE:
$message = 'No file was uploaded.';
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = 'Missing a temporary folder.';
break;
case UPLOAD_ERR_CANT_WRITE:
$message = 'Failed to write file to disk.';
break;
case UPLOAD_ERR_EXTENSION:
$message = 'A PHP extension stopped the file upload. ' .
'PHP does not provide a way to ascertain which extension caused the file ' .
'upload to stop; examining the list of loaded extensions with phpinfo() may help.';
break;
default:
$message = "Error number {$_FILES['file']['error']} occurred while uploading a file.";
}
die('{"jsonrpc" : "2.0", "error" : {"code": 104, "message": "' . $message . '"}, "id" : "id"}');
}
to have a helpful output in the JSON WS interface.
in ws_images_addSimple the $_FILES['image']['error'] is nicely interpreted and converted into a useful message. In ws_images_upload I request to have something similar. Maybe
```
if (isset($_FILES['file']['error']) && $_FILES['file']['error'] != 0)
{
switch($_FILES['file']['error'])
{
case UPLOAD_ERR_INI_SIZE:
$message = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
break;
case UPLOAD_ERR_FORM_SIZE:
$message = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
break;
case UPLOAD_ERR_PARTIAL:
$message = 'The uploaded file was only partially uploaded.';
break;
case UPLOAD_ERR_NO_FILE:
$message = 'No file was uploaded.';
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = 'Missing a temporary folder.';
break;
case UPLOAD_ERR_CANT_WRITE:
$message = 'Failed to write file to disk.';
break;
case UPLOAD_ERR_EXTENSION:
$message = 'A PHP extension stopped the file upload. ' .
'PHP does not provide a way to ascertain which extension caused the file ' .
'upload to stop; examining the list of loaded extensions with phpinfo() may help.';
break;
default:
$message = "Error number {$_FILES['file']['error']} occurred while uploading a file.";
}
die('{"jsonrpc" : "2.0", "error" : {"code": 104, "message": "' . $message . '"}, "id" : "id"}');
}
```
to have a helpful output in the JSON WS interface.
<!-- github-sync-id:509510414 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
in ws_images_addSimple the $_FILES['image']['error'] is nicely interpreted and converted into a useful message. In ws_images_upload I request to have something similar. Maybe
to have a helpful output in the JSON WS interface.