Display existing files in an MVC form

2 posts, 0 answers
  1. Reynner
    Reynner avatar
    1 posts
    Member since:
    Apr 2018

    Posted 20 Jul 2018 Link to this post


    I want to display the existing files based on the value of the HttpPostedFileBase properties in my view model. How can I achieve this without using asynchronous uploading?

    I tried what is written in this blog but whenever I save the form, the value of the files are lost.

                                            .Messages(m => m.Select("Upload"))
                                            .Validation(validation => validation
                                                .AllowedExtensions(new string[] { ".gif", ".jpg", ".png" })

    View model:
    public HttpPostedFileBase LogoImage { get; set; }

  2. Neli
    Neli avatar
    221 posts

    Posted 24 Jul 2018 Link to this post

    Hello Reynner,

    The files can be rendered initially in the file list of the Upload widget by using the file configuration. I am afraid that this option is available only when the Upload is in async mode. As far as I see in the provided blog post async upload is also used.
    You could take a look of Initial files Demo, where it is demonstrated how to persist the previously uploaded files.
    Here is also a link to StackOverflow where similar issue have been discussed. 

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top