0

I'm trying to use material UI upload button, to allow my users to upload profile images, so it looks like this:

<label htmlFor='icon-button-file'>
              <Input accept='image/*' id='icon-button-file' type='file' onChange={handleCaptureChange('profileImg')} />
              <IconButton
                color='secondary'
                aria-label='upload picture'
                component='span'
                
              >
                <StyledUploadButton />
              </IconButton>
            </label>

and this:

const handleCaptureChange = (prop: keyof State) => (event: React.ChangeEvent<HTMLInputElement>) => {
        setValues({
            ...values, 
            [prop]: event.target.value
        })
    }

the URL I receive whenever I tries it, and select an image will be like this: C:\fakepath\b062f046-fcb5-4c99-bd19-1fff9c11efed.jpg and this image is on my desktop, that's weird, how should I get the right location of the image?

Quentin
  • 857,932
  • 118
  • 1,152
  • 1,264
kyrolos magdy
  • 352
  • 1
  • 3
  • 14
  • Does this answer your question? [JavaScript: Upload file](https://stackoverflow.com/questions/5587973/javascript-upload-file) – Quentin Mar 02 '22 at 11:38

0 Answers0