Forbidden to upload PDF and SRT files

I recently switched hosts and updated to ClassicPress 2.6, so I am not sure whether this is a hosting limitation (Hetzner) or a CP problem. Asking here first.

Expected behavior

I expect to be able to upload SRT and PDF files, as I was before moving hosts and before updating to CP2.6

Current behavior

All of the possible ways to upload media give a message that I do not have permission to upload that type of file.

Context

I can upload via SFTP and insert items into posts by knowing the URL, although the files uploaded directly do not appear in the Media library.

seems a problem of chmods on files and folders in root directory to me… as if media library does not have permission to upload in the uploads folder

Uploads is 755 and so are the folders inside uploads.

If that were the problem, would it not also prevent uploads of jpeg files? They upload fine.

Sorry, i was under the impression that it wasn’t upload files at all - did not understand that it was a format specific issue.
I have no clue however without some other context. Have you tried to right click > Inspect > console and see what it says there?

I don’t know what an SRT file is, but you should certainly be able to upload PDFs in ClassicPress. The fact you can’t suggests to me that this is a hosting issue.

Try adding this to your wp-config.php

define( ‘ALLOW_UNFILTERED_UPLOADS’, true);

You should be able to use the standard uploader to upload these files then.

1 Like

To recapitulate: Uploading these files still DID WORK BEFORE moving your installation?

Then my first guess would be some sort of default configuration by Hetzner hosting.

What hosting do you use exactly? There are several types, starting from regular web hosting, to VPS / managed VPS, etc. Also, the lower tier plans of web hosting tend to be severly limited in their feature sets - albeit I couldnt find a specific “disable PDF / SRT” mentioned in the official Hetzner KB / doc pages.

The other option could be a plugin or other setting that you installed OR activated in your new environment, which is now limiting the upload of files with these extensions.

Thats to be expected, as the media library is not using files by itself, but representations of the media, with a specific internal post type called “attachment”. So it works similar to a symbolic link, just with extended properties (ie. meta data).

But there are quite a few plugins that allow you to directly or indirectly import media files, so if out of some reason you weren’t able to solve the “direct upload in CP” issue, you’d still be able to have your media files at hand in the media library.

cu, w0lf.

1 Like

The only thing in the console was a warning and the associated error.


jQuery.Deferred exception: Can't find variable: ClipboardJS 
copyAttachmentUploadURLClipboard — handlers.min.js:1:21937
(anonymous function) — handlers.min.js:1:22316
e — load-scripts.php:2:27034
(anonymous function) — load-scripts.php:2:27332
undefined

Well, that certainly did NOT work.

Fatal error: Uncaught Error: Undefined constant "‘ALLOW_UNFILTERED_UPLOADS’" in /usr/www/users/jgavxy/eatthispodcast.com/wp-config.php:100 Stack trace: #0 /usr/www/users/jgavxy/eatthispodcast.com/wp-load.php(50): require_once() #1 /usr/www/users/jgavxy/eatthispodcast.com/wp-admin/admin.php(34): require_once('/usr/www/users/...') #2 /usr/www/users/jgavxy/eatthispodcast.com/wp-admin/media-new.php(13): require_once('/usr/www/users/...') #3 {main} thrown in /usr/www/users/jgavxy/eatthispodcast.com/wp-config.php on line 100

I have the Large option for Hetzner web hosting package.

I have asked them directly if it could be a configuration option.

Thanks for the tip about a media scanner plugin.

An SRT file is a text file formatted to display subtitles.

1 Like

This forum software may have changed the apostrophe which is causing your issue.

See this post.

1 Like

You are right, of course. My apologies. I was so intent on getting the uploads working again that I didn’t think to check the single quotes.

Thank you.

2 Likes