publish .pdf of .doc files

Post Reply
RolandBlue
Jr. Bludit
Posts: 2
Joined: Wed May 23, 2018 9:19 pm

Wed May 23, 2018 9:35 pm

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
User avatar
Edi
Site Admin
Posts: 1567
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Wed May 23, 2018 11:49 pm

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.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
RolandBlue
Jr. Bludit
Posts: 2
Joined: Wed May 23, 2018 9:19 pm

Wed May 30, 2018 10:50 pm

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
User avatar
Edi
Site Admin
Posts: 1567
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Thu May 31, 2018 12:12 am

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.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
Kao
Jr. Bludit
Posts: 2
Joined: Tue Aug 06, 2019 1:58 pm

Tue Aug 06, 2019 2:32 pm

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
User avatar
Jay
Master Bludit
Posts: 67
Joined: Mon Feb 11, 2019 8:41 pm

Tue Aug 06, 2019 8:19 pm

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 ;)
Kao
Jr. Bludit
Posts: 2
Joined: Tue Aug 06, 2019 1:58 pm

Wed Aug 07, 2019 3:06 pm

Thank you Jay!

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