2024-10-15 10:50:56 +03:00
|
|
|
---
|
2024-09-24 11:38:18 +03:00
|
|
|
sidebar_position: 1
|
|
|
|
---
|
|
|
|
|
2024-10-15 10:50:56 +03:00
|
|
|
import Tabs from '@theme/Tabs';
|
|
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
|
2024-09-24 11:38:18 +03:00
|
|
|
# Upload file
|
|
|
|
Upload single file to Neocities
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function UploadFile(Val Token, Val Path, Val Data) Export`
|
|
|
|
|
2024-10-15 15:15:47 +03:00
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|
|
|-|-|-|-|-|
|
|
|
|
| Token | --token | String | ✔ | Auth token |
|
|
|
|
| Path | --path | String | ✔ | File path on Neocities |
|
|
|
|
| Data | --file | String, BinaryData | ✔ | URL, path or file data |
|
2024-09-24 11:38:18 +03:00
|
|
|
|
|
|
|
|
2024-10-09 09:42:00 +03:00
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Neocities
|
2024-09-24 11:38:18 +03:00
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
:::tip
|
2024-11-21 14:55:35 +03:00
|
|
|
Neocities API docs: [neocities.org/api](https://neocities.org/api)
|
|
|
|
|
2024-10-15 13:51:58 +03:00
|
|
|
Parameters with Binary data type can also accept file paths on disk and URLs
|
2024-09-24 11:38:18 +03:00
|
|
|
:::
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
2024-10-15 21:15:56 +03:00
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
2024-09-24 11:38:18 +03:00
|
|
|
Token = "7419cd51de4037f7...";
|
2024-10-15 10:07:27 +03:00
|
|
|
Data = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Path or Binary Data
|
2024-09-24 11:38:18 +03:00
|
|
|
Path = "testfolder/test_pic.png";
|
|
|
|
|
|
|
|
Result = OPI_Neocities.UploadFile(Token, Path, Data);
|
|
|
|
```
|
2024-10-15 09:53:37 +03:00
|
|
|
|
2024-09-24 11:38:18 +03:00
|
|
|
|
2024-10-20 22:36:03 +03:00
|
|
|
<Tabs>
|
|
|
|
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
|
|
```bash
|
|
|
|
oint neocities UploadFile \
|
2024-10-22 08:59:24 +03:00
|
|
|
--token "***" \
|
|
|
|
--path "testfolder/test_pic.png" \
|
|
|
|
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg"
|
2024-10-20 22:36:03 +03:00
|
|
|
```
|
|
|
|
</TabItem>
|
|
|
|
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
|
|
```batch
|
|
|
|
oint neocities UploadFile ^
|
2024-10-22 08:59:24 +03:00
|
|
|
--token "***" ^
|
|
|
|
--path "testfolder/test_pic.png" ^
|
|
|
|
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg"
|
2024-10-20 22:36:03 +03:00
|
|
|
```
|
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
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
|
|
|
```
|