grapesjs如何上传图片到后端?
网友回复
js代码
var editor = grapesjs.init( { showOffsets: 1, noticeOnUnload: 0, container: '#gjs', height: '100%', storageManager: false, plugins: [ ], assetManager: { upload: 'upload.php', assets:assetdata, uploadFile: (e) => { const formData = new FormData(); var files = e.dataTransfer ? e.dataTransfer.files: e.target.files; for (let i = 0; i < files.length; i++) { formData.append('files[]', files[i]); } fetch('/upload.php', { method: 'POST', body: formData }) .then(response => resp...
点击查看剩余70%