ReactJS Uppy - Show images in Uppy Dashbaord after state changes
See original GitHub issueHello
Uppy is working well with file uploading but Images are going to disappear when state changed, so is there any way to preserve image after upload. I found a very useful link on stackoverflow.com, I have the same problem. Please check this https://stackoverflow.com/questions/60201146/uppy-control-remove-uploaded-file-when-state-is-change
Unfortunately there are no answer, any help
Thanks in advance!!
import Uppy from '@uppy/core'
import XHRUpload from '@uppy/xhr-upload'
import Webcam from '@uppy/webcam'
import { DragDrop, Dashboard } from '@uppy/react'
import 'uppy/dist/uppy.css'
import '@uppy/status-bar/dist/style.css'
import '@styles/react/libs/file-uploader/file-uploader.scss'
const equipment_uppy = new Uppy({
id: 'equipment_uppy',
restrictions: { allowedFileTypes: ['image/*', 'video/*'] },
autoProceed: false
})
equipment_uppy.on('file-added', (file) => {
equipment_uppy.setFileMeta(file.id, {
type: file.source,
avintakeid : data.id
})
})
equipment_uppy.use(XHRUpload, {
endpoint: `${process.env.REACT_APP_SITE_URL}/api/auth/uploadavintakeimages`,
formData: true,
fieldName: 'files[]',
headers: {
Authorization: `Bearer ${localStorage.getItem('accessToken')}`
}})
equipment_uppy.use(Webcam)
<Dashboard
uppy={equipment_uppy}
id='equipment_location_image'
width='100%'
height='300px'
plugins={['Webcam']}
/>`
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
javascript - Show images in uppy dashboard after state changes
Save this question. Show activity on this post. I am using Uppy Dashboard and whenever the state changes uppy reset its state and...
Read more >Dashboard - Uppy
Image previews; Metadata editor; Upload progress; Ability to pause or cancel (depending on the uploader plugin) uploads. import ...
Read more >Uppy Image Editor shows 2 editable images instead of one
I'm using @uppy/image-editor and seeing two images that are both editable (only changes to the image on the right actually seem to be...
Read more >[Solved]-Slider won't show images in ReactJS-Reactjs
Show images in a Reactjs page only when a variable has a particular value · ReactJS Uppy - Show images in uppy dashboard...
Read more >Uppy (@uppy_io) / Twitter
Uppy adds files from local disk, Instagram, Unsplash (and more) crops images, records audio and screencasts, adapts to your desktop and mobile UI, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks a lot its worked for me by installing latest version & correct initialize for react.
Here is an example of the dashboard with react and state changes in the component. When used correctly, the dashboard stays the same even though the component re-renders.
Note: this example uses the latest major release. You are quite some versions behind.
https://codesandbox.io/s/kind-kare-vjzsd?file=/src/App.js