mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-08-01 08:48:05 +00:00
Compare commits
2
Commits
main
...
9f5ec7d97d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f5ec7d97d | ||
|
|
8296ffc3db |
@@ -406,12 +406,18 @@
|
|||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
// Backend contract (see api_v3.upload_plugin_asset): the request
|
||||||
|
// field must be named "files" (it does request.files.getlist('files')
|
||||||
|
// and 400s with "No files provided" otherwise), and the response
|
||||||
|
// carries the result in a top-level "uploaded_files" key, not nested
|
||||||
|
// under "data". file-upload-single.js's working upload flow uses this
|
||||||
|
// same contract.
|
||||||
// Backend contract (api_v3.upload_plugin_asset): field must be named
|
// Backend contract (api_v3.upload_plugin_asset): field must be named
|
||||||
// "files" (request.files.getlist('files')), and the response carries
|
// "files" (request.files.getlist('files')), and the response carries
|
||||||
// results in a top-level "uploaded_files" key, not nested under "data".
|
// results in a top-level "uploaded_files" key, not nested under "data".
|
||||||
formData.append('files', file);
|
formData.append('files', file);
|
||||||
formData.append('plugin_id', pluginId);
|
formData.append('plugin_id', pluginId);
|
||||||
|
|
||||||
fetch('/api/v3/plugins/assets/upload', {
|
fetch('/api/v3/plugins/assets/upload', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
|
|||||||
Reference in New Issue
Block a user