Answer the question
In order to leave comments, you need to log in
How to implement Upload image button in yii2?
The question is, there should be an "Add image" button, it is in the form. There are 5 thumbnails of these images that are filled with divs with a gray background, how to make it so that when you click on the button they are saved to those images?
I want to do like here
Answer the question
In order to leave comments, you need to log in
Make your own widget that will send the selected file to the server and create and upload a thumbnail using javascript
Good afternoon.
If you do not want to do it yourself, from scratch, then look here , maybe you will be lucky and you will find a package that will suit you 100%.
If not, then in the same place, you can take something similar and modify it to fit your needs.
ps Although Maxim Fedorov advises business.
In fact, there are several options:
1. Write functionality for ajax sending and saving a file to the server, and after the action is completed, update image previews on the client
2. Modern browsers support the functionality for displaying images when adding them to an input file without uploading files to the server, this is how many image croppers work, the image itself will be uploaded to the server immediately after submitting the form
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question