File input upload image
Hello,
https://keenthemes.com/metronic/tailwind/demo6/account/home/settings-sidebar
I want to use the photo upload area in this link, but I cannot post the selected value here. It gives an error that the file could not be selected. However, when I use standard input anywhere outside the library, there is no problem. Anyone have an idea?
Standard File Input:
image2: File {name: 'resim (1).png', lastModified: 1731595692891, lastModifiedDate: Thu Nov 14 2024 17:48:12 GMT+0300 (GMT+03:00), webkitRelativePath: '', size: 1716294, …}
Library
avatar: File {name: '', lastModified: 1731675149226, lastModifiedDate: Fri Nov 15 2024 15:52:29 GMT+0300 (GMT+03:00), webkitRelativePath: '', size: 0, …}
Replies (2)
Hi Hüsame Özçelik,
In the input form, there's an input field with the attribute name="avatar", for example:
<input type="file" name="avatar" accept=".png, .jpg, .jpeg"/> On your backend side, can you confirm if you're able to retrieve the file from the form input name="avatar"? It should be accessible as part of the request payload when the form is submitted. If you're not receiving it, double-check:
- The form's enctype should be set to "multipart/form-data".
- The file is correctly appended when using JavaScript to handle the form submission.
- The backend is configured to handle file uploads (e.g., $_FILES in PHP, request.files in Python Flask/Django, etc.).