silverstripe / silverstripe-admin

Silverstripe Admin Component
BSD 3-Clause "New" or "Revised" License
25 stars 94 forks source link

ENH leverage FormData to support file upload #1854

Open lekoala opened 1 week ago

lekoala commented 1 week ago

Description

Currently, ajax forms are submitted using serializeArray. This doesn't allow sending more advanced content, like a file upload

Manual testing steps

With this change, files are submitted properly. It also offers the opportunity to do more advanced things (eg: sending binary canvas data as a blob) and, all things considered, should probably work better because it uses a native js feature instead of jquery serializeArray

Issues

https://github.com/silverstripe/silverstripe-admin/issues/1852

Pull request checklist

GuySartorelli commented 1 day ago

The JS CI is failing as you haven't built the dist files. Can you please build that and include it in the PR? Instructions are at https://docs.silverstripe.org/en/5/contributing/build_tooling/

lekoala commented 2 hours ago

from what i see in the tests, it's not my changes that creates error but i've compiled the files

on windows, it requires this to work module.exports.rules['linebreak-style'] = ['error', 'windows'];

otherwise you get Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style

could be nice to add that as a default for https://github.com/silverstripe/eslint-config/blob/1/.eslintrc.js to make it windows friendly