This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi,
I've created a plugin with builder that is intended to save pdf files (as well as doc, docx) too.
I created an attachMany relation:
public $attachMany = [
'orderdocuments' => ['System\Models\File', 'public' => false]
];
and added a file upload widget to my backend form and the setting to the allowed extensions and mime like pdf, doc,docx
Upload is working fine, files are saved. By clicking on the attached file the usual dialog appears with title and description to edit and the attachment url . But I can't find a way to download or display the files from the backend like eg. in a webmail interface. The link created is something like this
http://.../backend/backend/files/get/NTIhNzufnHikdKLWQrsoplXRhYmFkNjA=
without any document at last and is stopped by the antivirus Any hints where I can find a howto?
Thanks in advance
Last updated
Not sure what you're trying to achive here. Backend models are usually used to create/update the models, and displaying the model would be done from the frontend...
Last updated
Hi mjauvin,
you got the point. The intention in my case is to use the backend as an administration tool to create and edit records - the frontend side will do other tasks. One field in this record is to hold a copy of one ore more order documents (usually as a pdf file). Now I'd like to view this pdf from the backend if necessary.
For example by creating a link like
<a href="http://www.example.com/whatpathever/myfile.pdf">myfile.pdf</a>
I found something close here: https://octobertricks.com/tricks/use-original-filename-thumbnail-name , but unfortunately I do not exactly understand how to use this for backend+pdf
Thanks in advance!
ok, then add an extra field of type=partial to your form, with context=update and add the code to display the pdf in the partial.
Last updated
1-4 of 4