
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@builtwithjavascript/vue-file-upload
Advanced tools
A Vue file upload component with validation, unstyled
A Vue file upload component with validation, unstyled
If you need a Tailwind styled version of this component, you can find it here: https://www.npmjs.com/package/@builtwithjavascript/vue-file-upload-tailwind
npm i -D @builtwithjavascript/vue-file-upload
<script setup lang="ts">
import { ref } from 'vue'
import { FileUploadComponent } from '@builtwithjavascript/vue-file-upload'
import type {
IFileInfo,
IFileValidatorOptions
} from '@builtwithjavascript/vue-file-upload'
const fileValidatorOptions: IFileValidatorOptions = {
allowedTypes: ['csv', 'json', 'txt'],
maxSize: 3, // in MB
maxNameLength: 60, // max name length in chars
nameTruncateMaxLength: 35, // will truncate the display of the name
propertiesToValidate: ['name', 'type', 'size']
}
const onUploadClicked = async (fileInfo: IFileInfo) => {
// do what you need to do with fileInfo.file
// i.e. create form data and post it to an API endpoint
const file = new FormData()
file.append('file', fileInfo.file as Blob)
const response = await someApiClient.post({
file: file
})
...
}
// optional: to reset from your parent component:
const refFileUploadComp = ref<InstanceType<typeof FileUploadComponent> | null>()
const reset = () => {
refFileUploadComp.value?.reset()
}
</script>
<template>
<FileUploadComponent
id="file-input"
uploadLabel="Import File"
ref="refFileUploadComp"
:validatorOptions="fileValidatorOptions"
:roundedCorners="true"
:showOnlyErrors="true"
successClass="success bg-pink-500"
errorClass = "error bg-gray-500"
inputCssClass = "border border-slate-500"
@uploadClicked="onUploadClicked" />
<!-- optional: to reset from your parent component -->
<button @click="reset">Reset</button>
</template>
NOTE: if you pass showOnlyErrors true, then only the validator items that fail will be displayed.
@builtwithjavascript/file-input-validator @testing-library/user-event @testing-library/vue @types/node @vitejs/plugin-vue jsdom prettier typescript vite vitest vitest-preview vue vue-tsc
FAQs
A Vue file upload component with validation, unstyled
We found that @builtwithjavascript/vue-file-upload demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.