View Uploaded file symfony4 - file-upload

How to view the uploaded file in symfony 4
Refered link:
https://symfony.com/doc/current/controller/upload_file.html
It throws error as Variable "brochure" does not exist. while viewing the uploaded file
In twig
View brochure (PDF)
here the entity file is brochure and uploaded file name is brochure

Related

Blazor Server-Side: Show file in razor page that is outside wwwroot folder

I have a PDF file in a folder called "UploadedFiles". This folder is not inside the wwwroot folder.
On the "showFile.razor" page I want to show this PDF.
How can I return the PDF file from UploadedFiles to showFile.razor
I used element on the showFile.razor page with the file in wwwroot and it worked, but the file is accessible for everyone when it is in wwwroot. This is not what I desire.

How to check if a file is in a zip file before uploading to a webpage

I'm using TypeScript to write an upload utility. Basically, it's just a div listening for a drop event.
Uploading uncompressed files or zip files works fine, but when a user drags and drops a file from within a zip file to my upload area, the uploaded file is corrupted (i.e. not decompressed).
Is there a way to determine if the file to be uploaded resides in a zip file? It would be nice to perform a check in my drop event before executing the actual upload. I can't find anything in the dataTransfer object.

Vue JS - how to list directory in public folder?

This is a snippet of my directory structure:
enter image description here
I have a songs folder under "public" directory containing a bunch of mp3 files.
I want my vue app to play a random song from that file
Everything is kinda settled, except for getting the paths (of the mp3 files) dynamically
For instance, if there are the following files in my public/songs directory - song1.mp3, song2.mp3 and song3.mp3, how do i get the list in vue js - ["song1.mp3", "song2.mp3", "song3.mp3"]?
Thank you

Download the .exe file instead of .htm file

My website has an option of downloading a .exe file. I uploaded this .exe file in dropbox and use the shared link in my website for the users to download the file.
I use href in my index.php page to create a link to that file:
<a href="https://www.dropbox.com/s/........./File.exe?dl=0" download="File">
But when users click that link in my website it downloads the .htm file. The users need to click this .htm file again which then leads to the download of the .exe file. At times users also get the error "There was an error downloading your file." while downloading the file from dropbox. I would like to know how to get the link to download the .exe file directly. Thanks!!!
When you use ?d1=0 at the end of your file path it will show the file in a preview page. Try changing it to ?dl=1to force the download.
https://www.dropbox.com/help/desktop-web/force-download

Error loading Partial View script (file: ~/Views/MacroPartials/Gallery.cshtml) in Umbraco project

Currently working on a project in Umbraco. Where I created a gallery using partial macro views. I tried to beautify the gallery by using lightbox plugin. I copied css file in css folder, images in images folder, js file in scripts folder from lightbox plugin. But while clicking gallery page it throw following error:
Error loading Partial View script (file: ~/Views/MacroPartials/Gallery.cshtml)
Probably just an error/bug in the Gallery.cshtml
You found the reason in the log file
goto: \App_Data\Logs\UmbracoTraceLog.txt
It looks like that view is missing a #using block
#using Umbraco.Web.PublishedContentModels
There should be a generated Image class in your App_Data\Models folder