Answer the question
In order to leave comments, you need to log in
How to implement image upload in Yii2 using Ajax without plugins?
Good day. I want to understand how to load images using ajax.
Implemented without Ajax and everything works fine. But the idea is to upload photos immediately when they are selected from the explorer.
I just can't figure out how to catch an asynchronous request in an action. That is, I track changes in the file field, transfer these files to the action. The FILES array has all the files, everything is fine. But then I have a stupor. With a normal photo upload, at the time of sending, I usually get everything from the model, but here there is no model as such. Or I misunderstood something. Please explain in which direction to dig? Or are things like that done differently?
I don’t want to use ready-made solutions, because I think that you need to be able to do such simple things. In normal php, in a procedural style, I do all this, but here I just can’t draw a parallel.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question