There is no name attribute to get the image on backed
MdFarzan opened this issue · comments
Hi, I was using this utility to upload a profile image but there is no name attribute to get the image on backend (I am using codeigniter on backend). and when I did set it (name attribute) I was getting en empty array with no attributes (like size, name etc).
Hmm, really the main thing this library does is hold the File
that was uploaded, and put it in an array. As can be seen in this screen shot from the demo, after I upload an image, I can see it there in the console.
If there's an issue receiving the file on your backend, you may need to look at the method with which you make your API call. You're most likely not packaging it as a proper File
type, so by the time it gets to the backend it's not readable.
I've answered a few questions like this before - maybe those can help:
- May I use html_form submit to backend?
- Not able to get the image name on server through AXIOS
- Only saving last image of multiple uploads
You'll probably want to research how to use FormData
with Codeigniter - sorry, I don't have any Codeigniter experience.
Oh, Now I understood. This utility can only upload a file using ajax as it's not holding any file. Correct me if I am wrong?
Well really that's how all front end file uploading is going to be - sending it to the backend is going to be through some form of API call.
How you handle that incoming depends on your backend. For example, with PHP, FormData
works just fine. For Codeigniter, I'm just not sure of the process needed there. Sorry I can't be of more help.
Ok, Thanks for your reply.