2024-09-24 11:38:18 +03:00
|
|
|
---
|
|
|
|
sidebar_position: 1
|
|
|
|
---
|
|
|
|
|
|
|
|
# Upload file
|
|
|
|
Upload single file to Neocities
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function UploadFile(Val Token, Val Path, Val Data) Export`
|
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Description |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Auth token |
|
|
|
|
| Path | --path | String | File path on Neocities |
|
|
|
|
| Data | --file | String, BinaryData | URL, path or file data |
|
|
|
|
|
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - Serialized JSON response from Neocities
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
:::tip
|
|
|
|
Neocities API docs: [neocities.org/api](https://neocities.org/api)
|
|
|
|
:::
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
```bsl title="Code example"
|
|
|
|
Token = "7419cd51de4037f7...";
|
|
|
|
Data = "https://openintegrations.dev/test_data/picture.jpg"; // URL, Path or Binary Data
|
|
|
|
Path = "testfolder/test_pic.png";
|
|
|
|
|
|
|
|
Result = OPI_Neocities.UploadFile(Token, Path, Data);
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```sh title="CLI command example"
|
|
|
|
|
2024-09-24 14:17:36 +03:00
|
|
|
oint neocities UploadFile --token "7419cd51de4037f7..." --path %path% --file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg"
|
2024-09-24 11:38:18 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-09-24 15:43:51 +03:00
|
|
|
{
|
|
|
|
"result": "success",
|
|
|
|
"message": "your file(s) have been successfully uploaded"
|
|
|
|
}
|
2024-09-24 11:38:18 +03:00
|
|
|
```
|