I have the following dropzone to display images stored in app_data folder but the thumnail doesn't work becuase the app_data folder is restricted to web users.
In the console i get:
"NetworkError: 404 Not Found - http://localhost:61372/app_data/wallimages/dropzonelayout.png"
I have delibrately stored the images in the app_data folder to restrict access and only users with certain roles can edit uploaded file i.e. delete etc. So my question is how can i display a thumbnail image in this scenario for editing uploaded files. I don't want to use some default image as I already know that could be another solution if i want to keep files stored in the app_data folder.
Any suggestions?
Dropzone.options.dropzoneForm = {
        acceptedFiles: "image/*",
        init: function () {
            var thisDropzone = this;
            $.getJSON("/home/GetAttachments/").done(function (data) {
                if (data.Data != '') {
                    $.each(data.Data, function (index, item) {
                            //// Create the mock file:
                            var mockFile = {
                                name: item.AttachmentID,
                                size: 12345
                            };
                            console.log(mockFile);
                            // Call the default addedfile event handler
                            thisDropzone.emit("addedfile", mockFile);
                            // And optionally show the thumbnail of the file:
                            thisDropzone.emit("thumbnail", mockFile, item.Path);
                            // If you use the maxFiles option, make sure you adjust it to the
                            // correct amount:
                            //var existingFileCount = 1; // The number of files already uploaded
                            //myDropzone.options.maxFiles = myDropzone.options.maxFiles - existingFileCount;
                    });
                }
            });
        }
    };
And this is the action to get the images:
 public ActionResult GetAttachments()
    {
        //Get the images list from repository
        var attachmentsList =  new List<AttachmentsModel>
        {
            new AttachmentsModel {AttachmentID = 1, FileName = "dropzonelayout.png", Path = "/app_data/wallimages/dropzonelayout.png"},
            new AttachmentsModel {AttachmentID = 2, FileName = "imageslider-3.png", Path = "/app_data/wallimages/imageslider-3.png"}
        }.ToList();
        return Json(new { Data = attachmentsList }, JsonRequestBehavior.AllowGet); 
    }
				
                        
You will need a controller action that will stream the image:
and now you can use this
/images/thumbnail?imagename=my_thumbnail.pngaction from the client: