Add file size validation of 20mb
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
<input style="display:none;" type="submit" bind:this={submit} />
|
||||
</form>
|
||||
</button>
|
||||
{:else if isBig && isUploaded === false}
|
||||
{:else if $uploadCourseVideoStore.formRes?.type === 'FILE_TOO_LARGE'}
|
||||
<div class="h-full w-full flex flex-col items-center justify-center rounded-xl">
|
||||
<img src="/video-upload-error.svg" alt="upload error" />
|
||||
<span class="pt-3 pb-2">
|
||||
@@ -102,7 +102,7 @@
|
||||
</span>
|
||||
<PrimaryButton label="Try again" />
|
||||
</div>
|
||||
{:else if isWrongFormat && isUploaded === false}
|
||||
{:else if $uploadCourseVideoStore.formRes?.success}
|
||||
<div class="h-full w-full flex flex-col items-center justify-center rounded-xl">
|
||||
<img src="/video-upload-error.svg" alt="upload error" />
|
||||
<span class="pt-3 pb-2">
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
<div style="position:relative;padding-bottom:51.416579%">
|
||||
<iframe
|
||||
src="https://muse.ai/embed/{video.metadata
|
||||
?.svid}?logo=https://app.classroomio.com/logo-512.png&volume=0&subtitles=auto&cover_play_position=center"
|
||||
?.svid}?logo=https://app.classroomio.com/logo-512.png&subtitles=auto&cover_play_position=center"
|
||||
style="width:100%;height:100%;position:absolute;left:0;top:0"
|
||||
frameborder="0"
|
||||
allowfullscreen
|
||||
|
||||
@@ -105,6 +105,14 @@ export const actions = {
|
||||
});
|
||||
}
|
||||
|
||||
if (formData.file?.size > 20 * 1024 * 1024) {
|
||||
return fail(400, {
|
||||
success: false,
|
||||
type: 'FILE_TOO_LARGE',
|
||||
message: 'File is too large'
|
||||
});
|
||||
}
|
||||
|
||||
const { file, lessonId } = formData;
|
||||
console.log('file', file);
|
||||
console.log('lessonId', lessonId);
|
||||
|
||||
Reference in New Issue
Block a user