D
D
Devil Devil2016-07-12 09:05:36
css
Devil Devil, 2016-07-12 09:05:36

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
0439ef04d26f48cda18768fb1a9b8637.JPGe4d838fd5df24fe985612002fe89d943.JPG68acd88988184ed1be1028b76b3d76de.JPG
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

1 answer(s)
2
2cha.headz, 2016-07-12
@BarkovA

Надеюсь правильно понял...
В 3м случае выводите текущую картинку в слой (куда хотите чтобы она была), далее при клике по инпуту вываливается окно для выбора файла, после выбора с помощью js/jquery + HTML5 File API получаете превьюшку картинки, которую выбрали в инпуте, и заменяете ей текущую картинку =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question