Bild -Hochladen von Nutzlast

const onFileChange = (event: any) => {
    {
      !isDocReplace ?
        (
          setUploadPayload({ ...uploadPayload, file: event.target.files[0] })

        ) :
        setReplacePayload({ ...replacePayload, file: event.target.files[0] })  // storing file detail for payload
    }
    setNewFileUploaded(true);
    setFileName(event.target.files[0].name);  // storing name of file in a state
  };

  <input type="file" onChange={onFileChange} id="raised-button-file" style={{ display: "none" }} />
coderyogi