How to use @uppy/core - 10 common examples

To help you get started, we’ve selected a few @uppy/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github transloadit / uppy / uppy-react-native / App.js View on Github external
componentDidMount () {
    this.uppy = Uppy({ autoProceed: false, debug: true })
    this.uppy.use(XHRUpload, {
      endpoint: 'http://192.168.1.7:7000/',
    })
    // this.uppy.use(Tus, { endpoint: 'https://master.tus.io/files/' })
    this.uppy.on('upload-progress', (file, progress) => {
      this.setState({
        progress: progress.bytesUploaded,
        total: progress.bytesTotal
      })
    })
    this.uppy.on('complete', (ev) => {
      this.setState({
        status: 'Upload complete ✅'
      })
      console.log('tadada!')
      console.log(this.uppy.state.files)
github transloadit / uppy / examples / react-native-expo / App.js View on Github external
uploadStarted: false,
      uploadComplete: false,
      info: null,
      totalProgress: 0
    }

    this.isReactNative = (typeof navigator !== 'undefined' &&
      typeof navigator.product === 'string' &&
      navigator.product.toLowerCase() === 'reactnative')

    this.showFilePicker = this.showFilePicker.bind(this)
    this.hideFilePicker = this.hideFilePicker.bind(this)
    this.togglePauseResume = this.togglePauseResume.bind(this)

    console.log('Is this React Native?', this.isReactNative)
    this.uppy = Uppy({ autoProceed: true, debug: true })
    this.uppy.use(Tus, {
      endpoint: 'https://master.tus.io/files/',
      urlStorage: AsyncStorage,
      fileReader: getTusFileReader,
      chunkSize: 10 * 1024 * 1024 // keep the chunk size small to avoid memory exhaustion
    })
    this.uppy.on('upload-progress', (file, progress) => {
      this.setState({
        progress: progress.bytesUploaded,
        total: progress.bytesTotal,
        totalProgress: this.uppy.state.totalProgress,
        uploadStarted: true
      })
    })
    this.uppy.on('upload-success', (file, response) => {
      // console.log(file.name, response)
github transloadit / uppy / uppy-react-native-expo / App.js View on Github external
componentDidMount () {
    this.uppy = Uppy({ autoProceed: false, debug: true })
    this.uppy.use(XHRUpload, {
      // endpoint: 'http://192.168.1.7:7000/',
      endpoint: 'http://api2.transloadit.com/',
    })
    // this.uppy.use(Tus, { endpoint: 'https://master.tus.io/files/' })
    this.uppy.on('upload-progress', (file, progress) => {
      this.setState({
        progress: progress.bytesUploaded,
        total: progress.bytesTotal
      })
    })
    this.uppy.on('complete', (ev) => {
      this.setState({
        status: 'Upload complete ✅'
      })
      console.log('tadada!')
github transloadit / uppy / packages / @uppy / react / src / propTypes.js View on Github external
const PropTypes = require('prop-types')
const UppyCore = require('@uppy/core').Uppy

// The `uppy` prop receives the Uppy core instance.
const uppy = PropTypes.instanceOf(UppyCore).isRequired

// A list of plugins to mount inside this component.
const plugins = PropTypes.arrayOf(PropTypes.string)

// Language strings for this component.
const locale = PropTypes.shape({
  strings: PropTypes.object,
  pluralize: PropTypes.func
})

// List of meta fields for the editor in the Dashboard.
const metaField = PropTypes.shape({
  id: PropTypes.string.isRequired,
github transloadit / uppy / examples / dev / Dashboard.js View on Github external
module.exports = () => {
  const uppyDashboard = Uppy({
    logger: Uppy.debugLogger,
    meta: {
      username: 'John',
      license: 'Creative Commons'
    }
  })
    .use(Dashboard, {
      trigger: '#pick-files',
      // inline: true,
      target: '.foo',
      metaFields: [
        { id: 'license', name: 'License', placeholder: 'specify license' },
        { id: 'caption', name: 'Caption', placeholder: 'add caption' }
      ],
      showProgressDetails: true,
      proudlyDisplayPoweredByUppy: true,
      note: '2 files, images and video only'
github transloadit / uppy / test / endtoend / create-react-app / src / App.js View on Github external
constructor (props) {
    super(props)

    this.uppy = new Uppy({ id: 'uppy1', autoProceed: true, debug: true })
      .use(Tus, { endpoint: `${endpoint}/files/` })
      .use(GoogleDrive, { companionUrl: 'https://companion.uppy.io' })

    this.uppy2 = new Uppy({ id: 'uppy2', autoProceed: false, debug: true })
      .use(Tus, { endpoint: `${endpoint}/files/` })

    this.state = {
      showInlineDashboard: true,
      open: false
    }

    this.handleModalClick = this.handleModalClick.bind(this)
  }
github transloadit / uppy / website / src / api-usage-example.js View on Github external
import Uppy from '@uppy/core'
import Dashboard from '@uppy/dashboard'
import Instagram from '@uppy/instagram'
import Tus from '@uppy/tus'

Uppy()
  .use(Dashboard, {
    trigger: '#select-files',
    showProgressDetails: true
  })
  .use(Instagram, {
    target: Dashboard,
    serverUrl: 'https://companion.uppy.io'
  })
  .use(Tus, { endpoint: 'https://master.tus.io/files/' })
  .on('complete', (result) => {
    console.log('Upload result:', result)
  })
github Lambda-School-Labs / CS10-restaurant-pos / client / src / components / Presentational / UploadModal / index.js View on Github external
componentDidMount() {
    const { folderName, setImageUrls } = this.props;

    this.uppy = Uppy({
      id: 'MyUppy',
      debug: false,
      autoProceed: false,
      restrictions: {
        maxFileSize: 1000000,
        maxNumberOfFiles: 1,
        minNumberOfFiles: 1,
        allowedFileTypes: ['image/*']
      }
    })
      .use(Transloadit, {
        service: 'https://api2.transloadit.com',
        waitForEncoding: true,
        waitForMetadata: false,
        importFromUploadURLs: false,
        alwaysRunAssembly: false,
github metaspace2020 / metaspace / metaspace / webapp / src / components / UppyUploader / index.tsx View on Github external
setup(props, { attrs }) {
    const state = reactive({
      error: false,
      fileName: null,
      progress: 0,
      status: 'IDLE',
    })

    preventDropEvents()

    const uppy = Uppy(uppyOptions)
      .use(AwsS3Multipart, {
        limit: 2,
        companionUrl: config.companionUrl || `${window.location.origin}/database_upload`,
      })
      .on('file-added', file => {
        state.fileName = file.name
        state.status = 'HAS_FILE'
      })
      .on('upload', () => {
        state.error = false
        state.progress = 0
      })
      .on('upload-progress', (file) => {
        const { percentage } = file.progress
        if (percentage > state.progress) {
          state.progress = file.progress.percentage
github danielmahon / opencrud-admin / src / components / ui / forms / FormikFileField.js View on Github external
constructor(props) {
    super(props);
    this.uppy = Uppy({
      restrictions: { maxNumberOfFiles: 1 },
      autoProceed: false,
    });
    this.uppy.on('file-added', file => {
      if (file.type.includes('video')) {
        this.uppy.use(Tus, {
          id: 'vimeo',
          endpoint: `${process.env.REACT_APP_GRAPHQL_ENDPOINT}/video/upload`,
          resume: true,
          autoRetry: true,
          retryDelays: [0, 1000, 3000, 5000],
          headers: { authorization: `Bearer ${props.auth.token}` },
        });
      } else {
        this.uppy.use(AwsS3, {
          id: 'google',

@uppy/core

Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:

MIT
Latest version published 22 days ago

Package Health Score

95 / 100
Full package analysis