-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bigFile): built in component for big files uploads
- Loading branch information
Showing
27 changed files
with
706 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import {sequence} from 'astro:middleware'; | ||
import { sequence } from 'astro:middleware'; | ||
import astroForms from '@astro-utils/forms'; | ||
|
||
export const onRequest = sequence(astroForms()); | ||
export const onRequest = sequence(astroForms({ | ||
forms: { | ||
bigFilesUpload: { | ||
bigFileServerOptions: { | ||
maxUploadSize: 1024 * 1024 // 1MB | ||
} | ||
} | ||
} | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
import Layout from '../layouts/Layout.astro'; | ||
import {BButton, Bind, BindForm, BInput, FormErrors, UploadBigFile, UploadBigFileProgress} from '@astro-utils/forms/forms.js'; | ||
import {Button} from 'reactstrap'; | ||
import 'bootstrap/dist/css/bootstrap.css'; | ||
import type { BigFile } from '../../../../packages/forms/dist/components/form/UploadBigFile/BigFile.ts'; | ||
type Form = { | ||
file: BigFile; | ||
} | ||
const form = Bind<Form>(); | ||
let showSubmitText: string; | ||
function formSubmit() { | ||
showSubmitText = `you upload "${form.file.name}"`; | ||
} | ||
--- | ||
<Layout title="Upload file"> | ||
<BindForm bind={form}> | ||
<FormErrors/> | ||
{showSubmitText} | ||
|
||
<h4>File to upload*</h4> | ||
|
||
<div style="display: flex; flex-direction: column; gap: 10px"> | ||
<UploadBigFile name='file' required/> | ||
<UploadBigFileProgress for='file' /> | ||
</div> | ||
|
||
<BButton as={Button} props={{color: 'success'}} onClick={formSubmit} whenFormOK>Submit</BButton> | ||
</BindForm> | ||
</Layout> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.