Allow forms to have a file upload enctype
This commit is contained in:
parent
6348692473
commit
f68e81836b
@ -14,6 +14,7 @@
|
|||||||
export let isBoldSubmit: boolean = true;
|
export let isBoldSubmit: boolean = true;
|
||||||
export let resetButton: boolean = false;
|
export let resetButton: boolean = false;
|
||||||
export let confirm: string = undefined;
|
export let confirm: string = undefined;
|
||||||
|
export let withFiles: boolean = false;
|
||||||
|
|
||||||
const formId = nextAvailableFormId++;
|
const formId = nextAvailableFormId++;
|
||||||
setContext('formId', formId);
|
setContext('formId', formId);
|
||||||
@ -37,7 +38,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<form {action} method="POST" id="{formId}-form" on:submit={handleSubmit}>
|
<form {action} method="POST" id="{formId}-form" on:submit={handleSubmit} enctype={withFiles ? 'multipart/form-data' : undefined}>
|
||||||
<CsrfTokenField/>
|
<CsrfTokenField/>
|
||||||
<slot/>
|
<slot/>
|
||||||
<div class="form-controls">
|
<div class="form-controls">
|
||||||
|
Loading…
Reference in New Issue
Block a user