Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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, …}


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

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.).



Anyone have any ideas?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(