Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
blocks:api:upload [2023-03-04 11:01] admin [Upload a text snippet as urlencoded data] |
blocks:api:upload [2025-02-04 13:57] (current) admin [File Upload API] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== File Upload API ====== | ====== File Upload API ====== | ||
- | Blocks provides an HTTP API for uploading files, for example images. Uploaded files are temporarily stored in a subdirectory of the //temp// directory inside your Blocks root directory, | + | Blocks provides an HTTP API for uploading files, for example images. Uploaded files are temporarily stored in a subdirectory of the //temp// directory inside your Blocks root directory. This directory is not externally accessible for reading data. Thus, uploaded files must then be moved or further processed by a script. As an example, [[blocks: |
+ | :!: **IMPORTANT**: | ||
===== Upload file using multipart/ | ===== Upload file using multipart/ | ||
**URL:** / | **URL:** / | ||
Line 46: | Line 47: | ||
===== Upload an image as urlencoded data ===== | ===== Upload an image as urlencoded data ===== | ||
- | Here's is an example showing how to upload a PNG image with a unique file name as urlencoded data. Once this is done, the script logs the server-side name of the file, which you would then normally use to call some custom [[blocks: | + | Here's is an example showing how to upload a PNG image with a unique file name as urlencoded data. Once this is done, the script logs the server-side name of the file, which you would then normally use to call some custom [[blocks: |
< | < |