mycode
- Get link
- X
- Other Apps
<Typography id="modal-modal-description" sx={{ mt: 2 }} onClick={()=>fileInput.current.click()}>
<img src={Gallery} style={{ height:'4vh',width:'4vw'}} /> <span >Upload from Gallery</span>
<input type="file" ref={fileInput} accept='.jpg,.jpeg,.png' name="file" style={{display:'none'}} onChange={handleFileChange}/>
</Typography>
<img src={Gallery} style={{ height:'4vh',width:'4vw'}} /> <span >Upload from Gallery</span>
<input type="file" ref={fileInput} accept='.jpg,.jpeg,.png' name="file" style={{display:'none'}} onChange={handleFileChange}/>
</Typography>
Gaurav pandey
const handleFileChange = (e) => {
const file = e.target.files[0];
console.log(file);
setSelectedFile(file);
handleUpload(file);
// const imageUrl = URL.createObjectURL(file);
// setPicture(imageUrl);
setOpen(false);
}; const handleUpload = async(file) => {
console.log('uploaded');
// Your file upload logic here
// if (selectedFile) {
console.log(file);
const imageUrl = URL.createObjectURL(file);
setPicture(imageUrl);
// console.log({id}.id.charAt(0));
const currentmonth=({id}.id.charAt(0))
const formData = new FormData();
formData.append('file', file);
const file = e.target.files[0];
console.log(file);
setSelectedFile(file);
handleUpload(file);
// const imageUrl = URL.createObjectURL(file);
// setPicture(imageUrl);
setOpen(false);
}; const handleUpload = async(file) => {
console.log('uploaded');
// Your file upload logic here
// if (selectedFile) {
console.log(file);
const imageUrl = URL.createObjectURL(file);
setPicture(imageUrl);
// console.log({id}.id.charAt(0));
const currentmonth=({id}.id.charAt(0))
const formData = new FormData();
formData.append('file', file);
- Get link
- X
- Other Apps
Comments
Post a Comment