Page 1 of 2

publish .pdf of .doc files

Posted: Wed May 23, 2018 9:35 pm
by RolandBlue
Hi,
I made a bludit site for a small public library. There is a need to share a few .doc and .pdf files.
How can this be managed using the admin web interface ? I tried uploading the file as an image but it does check the extension and only jpg, jpeg, gif and png are allowed and thus cannot be done this way.

Thank you for your help,

Roland

Re: publish .pdf of .doc files

Posted: Wed May 23, 2018 11:49 pm
by Edi
The types are set in in the file uploader.php (in the directory /bl-kernel/ajax/).

To allow the uploading of PDF files the array $validExtension can be modified as follows (line 18):

Code: Select all

$validExtension = array('tiff', 'gif', 'png', 'jpg', 'jpeg', 'bmp', 'svg','pdf')
See also Upload von PDF-, Audio- und Video-Dateien.

Re: publish .pdf of .doc files

Posted: Wed May 30, 2018 10:50 pm
by RolandBlue
Thank you. I can upload pdf this way. I does need some documentation to link to the pdf as you cannot have the name of the file once uploaded.
I think it will do the job or I will upload the files with an FTP client.

Roland

Re: publish .pdf of .doc files

Posted: Thu May 31, 2018 12:12 am
by Edi
RolandBlue wrote: Wed May 30, 2018 10:50 pm I can upload pdf this way. I does need some documentation to link to the pdf as you cannot have the name of the file once uploaded.
Yes, there are some restrictions naming files at the moment.

Re: publish .pdf of .doc files

Posted: Tue Aug 06, 2019 2:32 pm
by Kao
Hi all,

I hope you can help me: I want to upload .pdf using the admin web interface, and the suggested solution does not work (Bludit 3.9.2).

In fact, in my upload-images.php, there is no $validExtension array which I can change.
I didn't found it on other places either. Why?

In the directory /bl-kernel/admin/themes/booty/html/ I found this code in the media.php
const validImageTypes = ['image/gif', 'image/jpeg', 'image/png', 'image/svg+xml'];

and in bl-kernel/boot/variables.php there is
// Allowed image extensions
$GLOBALS['ALLOWED_IMG_EXTENSION'] = array('gif', 'png', 'jpg', 'jpeg', 'svg');
but it does not work if I add .pdf to either one or both of this codes.
If I try to upload a .pdf after adding it there, I get the message
File type is not supported. Allowed types: gif, png, jpg, jpeg, svg, pdf
Any ideas what is going wrong and how to fix it?

Thank you,

Kao

Re: publish .pdf of .doc files

Posted: Tue Aug 06, 2019 8:19 pm
by Jay
Kao wrote: Tue Aug 06, 2019 2:32 pm Any ideas what is going wrong and how to fix it?
You were heading in the right direction as things changed in B 3.9.X
Basically you need to
1. add a valid mime type of the files you want to upload in validImageTypes array
For pdf files add:

Code: Select all

application/pdf


2. add allowed file extension in ALLOWED_IMG_EXTENSION variable, which you have already done judging by the error message

edit, save, upload changes, and let us know if everything works as supposed ;)

Re: publish .pdf of .doc files

Posted: Wed Aug 07, 2019 3:06 pm
by Kao
Thank you Jay!

It worked! In my first try, I did not know that it is named "application" before the slash!

Re: publish .pdf of .doc files

Posted: Mon Dec 30, 2019 3:00 pm
by saum
I also applied the changes to upload a pdf file, which is working! :)

But how do I create a link to the pdf file?

Re: publish .pdf of .doc files

Posted: Thu Jan 02, 2020 12:22 am
by Edi
As HTML link (with the absolute path to the file).

Re: publish .pdf of .doc files

Posted: Mon Jan 27, 2020 8:58 pm
by jmonroe
This is good information to know. Thanks