Answer the question
In order to leave comments, you need to log in
How to pass image from database to display (view)?
Good day! When developing a simple site, I encountered the following problem:
There is a database in which, in addition to various textual information, a picture is stored in the format (varbinary (MAX)). It was not difficult to transfer a picture to View, however, when editing information, it is not possible to transfer this picture for editing. Screenshots
1- how the picture is simply displayed
2- the action of the controller to update 3- to update (it is clear that even though it is written there it will not be transmitted), but I don’t know how
to
do it correctly
to update, and that picture is loaded there, and you can select a new file and replace that one
but it turns out that if the user edits the text, but does not upload the picture, then there is no picture at all.
How to solve such a question??
Answer the question
In order to leave comments, you need to log in
Надеюсь правильно понял...
В 3м случае выводите текущую картинку в слой (куда хотите чтобы она была), далее при клике по инпуту вываливается окно для выбора файла, после выбора с помощью js/jquery + HTML5 File API получаете превьюшку картинки, которую выбрали в инпуте, и заменяете ей текущую картинку =)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question