Quiero obtener una vista previa de la imagen tan pronto como la cargue, pero la vista previa de la imagen no está visible cuando estoy cargando la imagen. No hay código para la vista previa de la imagen en la pantalla, si alguien sabe qué línea de código debo agregar aquí para poder obtener una vista previa de mi imagen, será realmente útil. Puede alguien ayudarme con esto. aquí está el código
<label className="input_label_profile">Image</label> <br/> <label style={{backgroundColor:'#eeeeee',borderRadius:'0px',border:'1px dashed #999999',height:'8vw',width:'8vw'}} className="add-user-upload-image add-user-upload-image-2"> <Form.Item name="experience_image" style={{height:'0px'}}> <Input accept="image/*" id="raised-button-file" multiple type="file" onChange={(event) => { this.addImage(event.target.files[0]) } } style={{height:'0px'}} /> </Form.Item> <PlusOutlined /> <br/> <br/> <br/> <span style={{cursor: 'pointer',marginTop:'5vw'}}> UPLOAD IMAGE</span> </label>Y aquí está la función addImage:
addImage = (image) => { console.log("image name:",image); const file = image this.setState({ file: file, fileNameLocal:image.name, }); let img_type = file.type this.setState({ img_type: img_type }) const uploadParams = { files: [ { requestType: 'CandidateProfile', contentType: img_type, }, ], }; APIManager.preSignedUrl(uploadParams).then((resp) => { if (resp.status === 200) { console.log(resp) this.setState({ uploadUrl:resp.data[0].url, fileName:resp.data[0].fileName, experience_image:resp.data[0].fileName }) this.uploadOnS3(file); } }); }