New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@builtwithjavascript/react-file-upload

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@builtwithjavascript/react-file-upload

A React file upload component with validation - unstyled

latest
Source
npmnpm
Version
1.0.9
Version published
Maintainers
1
Created
Source

@builtwithjavascript/react-file-upload

A React file upload component with validation (unstyled).

npm version

Screenshot

React Screenshot

NOTE

This component is not styled. You will have to provide the necessary css classes for the various elements:

  • The main component has class file-upload-component
  • The input component has class file-input-label
  • The file validator component has class file-validator and inner class file-validator-inner
  • Each file validator child row component has class file-validator-row (in addition, they can have class first, last, success, error)

If you use Tailwind CSS, use the @builtwithjavascript/react-file-upload-tailwind package, which can be found here: https://www.npmjs.com/package/@builtwithjavascript/react-file-upload-tailwind

Run-time Dependencies

  • React

Install

npm i -D @builtwithjavascript/react-file-upload

Consume

import { FileUploadComponent } from '@builtwithjavascript/react-file-upload' 
import type { 
  IFileInfo,
  IFileValidatorOptions
} from '@builtwithjavascript/react-file-upload' 

const fileValidatorOptions: IFileValidatorOptions = {
  allowedTypes: ['csv', 'xls'],
  maxSize: 50, // in MB
  maxNameLength: 60, // max name length in chars
  nameTruncateMaxLength: 35, // will truncate the display of the name
  propertiesToValidate: ['name', 'type', 'size']
}

const onUploadClick = 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
  })

  ...
}

...

<FileUploadComponent id="my-file-upload" 
  uploadLabel="Import file"
  validatorOptions={fileValidatorOptions}
  showOnlyErrors={true}
  roundedCorners={true}
  onUploadClick={onUploadClick}
/>

NOTE: if you pass showOnlyErrors true, that only the validator items that fail will be displayed.

Keywords

component, libraries, scripts, javascript, large scale apps, vue, react, svelte, nuxt, next, node

FAQs

Package last updated on 18 Dec 2025

Did you know?

Socket

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.

Install

Related posts