Changes
Title
unchanged
Displaying uploaded file from DB for update with FileInput widget
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
yii2, file, File upload, fileinput, upload, image, update, server, client
Content
changed
This is for folks who are using [`\kartik\widgets\FileInput`](http://demos.krajee.com/widget-details/file-input "") to upload files from your client. How do you display an image for update after you have uploaded it to the server using the widget?
> NOTE: The FileInput plugin has been upgraded to v1.5.0 since this wiki is written. With this release, it allows you to set an initial preview and caption of files (for update scenarios). Refer [usage demo](http://demos.krajee.com/widget-details/fileinput
#advanced-usage) or [plugin docs](http://plugins.krajee.com/file-input) and [plugin demos](http://plugins.krajee.com/file-input/demo).
Understanding Basics
--------------------
The FileInput widget is an enhancement of the HTML5 file input. It offers you the ability to preview your selected files from the client before it is uploaded to the server. It also supports a method to upload single or multiple files from the client to the server. However, this process occurs only one way, as this is limited by the HTML5 file input capability. Hence the file input only pushes/uploads files from client to server and not vice-versa. Therefore, it does not offer a method to fetch a preselected value from the server and display on the client. Hence, once the file is uploaded to the server, you cannot display the uploaded file directly from the file input.[...]