fix: use fd.append 3rd arg to set slugified filename in multipart upload
This commit is contained in:
@@ -139,7 +139,7 @@ function initUpload(formEl) {
|
|||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('file', new File([file], slugifyFilename(file.name), { type: file.type }));
|
fd.append('file', file, slugifyFilename(file.name));
|
||||||
|
|
||||||
const res = await apiFetch(`${API}/pages${route}/media`, { method: 'POST', body: fd });
|
const res = await apiFetch(`${API}/pages${route}/media`, { method: 'POST', body: fd });
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user