📜  图片上传有效载荷 - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:38.534000             🧑  作者: Mango

代码示例1
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
  };