sufi's avatar
Level 1

File upload

I want to upload a pdf or document file after uploading

<a href="#" target="_blank">View</a>

<a href="#" target="_blank">delete</a>

on View click open a file in browser and on delete Click delete the file.

0 likes
1 reply
bashy's avatar

You need to setup a route to serve the PDF file. For delete, you need to use the destroy method and do a DELETE via POST.

Something like this via JS is handy since you don't have to keep writing the form out for delete buttons: https://gist.github.com/stevemo/5112425

Please or to participate in this conversation.