You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-2Lines changed: 21 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -343,7 +343,7 @@ See it's defaults in [src/Formidable.js DEFAULT_OPTIONS](./src/Formidable.js)
343
343
newFilename. Must return a string. Will be joined with options.uploadDir.
344
344
345
345
-`options.filter`**{function}** - default function that always returns true.
346
-
Use it to filter files before they are uploaded. Must return a boolean.
346
+
Use it to filter files before they are uploaded. Must return a boolean. Will not make the form.parse error
347
347
348
348
-`options.createDirsFromUploads`**{boolean}** - default false. If true, makes direct folder uploads possible. Use `<input type="file" name="folders" webkitdirectory directory multiple>` to create a form to upload folders. Has to be used with the options `options.uploadDir` and `options.filename` where `options.filename` has to return a string with the character `/` for folders to be created. The base will be `options.uploadDir`.
349
349
@@ -371,7 +371,7 @@ form.bytesExpected;
371
371
372
372
#### `options.filter`**{function}** function ({name, originalFilename, mimetype}) -> boolean
373
373
374
-
**Note:** use an outside variable to cancel all uploads upon the first error
374
+
Behaves like Array.filter: Returning false will simply ignore the file and go to the next.
375
375
376
376
```js
377
377
constoptions= {
@@ -382,6 +382,25 @@ const options = {
382
382
};
383
383
```
384
384
385
+
**Note:** use an outside variable to cancel all uploads upon the first error
386
+
387
+
**Note:** use form.emit('error') to make form.parse error
388
+
389
+
```js
390
+
let cancelUploads =false;// create variable at the same scope as form
0 commit comments