Draken ∆Toman
KPCKevin Powell - Community
•Created by Draken ∆Toman on 8/18/2024 in #front-end
File upload bug
<DropdownMenuItem >
<label htmlFor="profile-picture" className="flex items-center gap-2 cursor-pointer">
<FileUp strokeWidth={1} width={20} height={20}/>
<span>profile</span>
<input
id="profile-picture"
type="file"
accept="image/*"
className="hidden"
onChange={changePfp}
/>
</label>
</DropdownMenuItem>
functions that will trigger to change the profile picture of the user
function changePfp(e) {
let file = e.target.files[0];
uploadImage(file)
}
const uploadImage = (file) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = () => {
const base64data = reader.result;
socket.emit('edit-pfp', {image : base64data});
};
};
Whenever I clicked it is prompting the file to upload and when I set the file and upload it.
It is not triggering the changepfp function.
I am not understading why it is not working as expected.
Could you please help me with it.
Thank you.2 replies
KPCKevin Powell - Community
•Created by Draken ∆Toman on 12/7/2023 in #front-end
Double images
index.js
When the site loads I have to get 10 images instead getting 20 images
Another 10 images are same as the first 10 images
1 replies