Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

upload image in react next js authentication

import React, { useState } from 'react'
import { FilePond, registerPlugin } from 'react-filepond'
import FilePondPluginImagePreview from 'filepond-plugin-image-preview'
import 'filepond/dist/filepond.min.css'
// import 'bootstrap/dist/css/bootstrap.min.css'
// import FileSizeValidate from './components/FileSizeValidate'
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css'
import FilePondPluginFileValidateSize from 'filepond-plugin-file-validate-size';
registerPlugin(FilePondPluginFileValidateSize, FilePondPluginImagePreview)
export default function image() {
    const [files, initFiles] = useState([])
  return (
      <div>
          <div className="container mt-5">
    <h2 className="mb-4">React File Upload Size Validation Example</h2>
    <FilePond
      files={files}
                  allowFileSizeValidation={true}
                //   200000
      maxFileSize={555000}
      labelMaxFileSizeExceeded={'File is too large'}
    />
  </div></div>
  )
}

 
PREVIOUS NEXT
Tagged: #upload #image #react #js #authentication
ADD COMMENT
Topic
Name
3+3 =