• Resolved grezes71

    (@grezes71)


    Today I tried uploading a PDF into my newsletter media gallery folder something that I have done many times before. I received the error “[filename] file’s type is invalid.” I am not sure why this has stopped working. Is there a setting to change that allows for non-image file types?

    Media Library Folders = 5.1.7
    WordPress = 5.3.2

    Only other change is that I recently added MaxGalleria

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author AlanP57

    (@alanp57)

    I’m not able to reproduce this issue. There is not any specific code the prevents the uploading of PDF files. The plugin uses the standard WordPress function for checking if the file is allow on your site. You can test if this is caused by Media Library Folders by deactivating it and upload the PDF file to your media library. Note that with Media Library Folders deactivated, the plugin will not be able to store the folder location of the PDF file.

    These is a way to deactivate the test for allowed file types which is to add this line of code to your wp-config.php file:

    define(‘ALLOW_UNFILTERED_UPLOADS’, true);

    Thread Starter grezes71

    (@grezes71)

    Hello,

    I couldn’t upload the PDF via the regular media method. It errored with “Sorry, this file type is not permitted for security reasons”. But if I disable the MaxGalleria plugin, I can upload PDFs by either method. Is it possible that MaxGalleria is interfering? I assumed that these two plugins would work together since they are made by the same company. Thanks.

    Plugin Author AlanP57

    (@alanp57)

    Which plugin do you mean? MaxGalleria is our gallery plugin for images and Media Library Folders is the one for uploading and moving files.

    I am still unable to reproduce your issue even with MaxGalleria activated and I have searched the Media Library Folders code for anything that would prevent the uploading of this file type and have not found anything.

    Peter Smits

    (@psmits1567)

    Hi Alan

    Tested this situation, could not reproduce it also.
    But when removing the file I get an error
    Warning: Illegal string offset ‘sizes’ in /www/wp-content/plugins/media-library-plus/maxgalleria-media-library.php on line 2668

    Notice: Uninitialized string offset: 0 in /www/wp-content/plugins/media-library-plus/maxgalleria-media-library.php on line 2668

    Warning: Invalid argument supplied for foreach() in /www/wp-content/plugins/media-library-plus/maxgalleria-media-library.php on line 2668
    {“message”:”De bestand(en) zijn verwijderd\n”,”files”:”<script type=\”text\/javascript\”>\n\tjQuery(document).ready(function() {\n\tvar mif_visible = (jQuery(\”#mgmlp-media-search-input\”).is(\”:visible\”)) ? false : true;\n jQuery.ajax({\n type: \”POST\”,\n async: true,\n data: { action: \”mlp_display_folder_contents_ajax\”, current_folder_id: \”891\”, image_link: \”1\”, mif_visible: mif_visible, nonce: mgmlp_ajax.nonce },\n url: mgmlp_ajax.ajaxurl,\n dataType: \”html\”,\n success: function (data) \n {\n jQuery(\”#mgmlp-file-container\”).html(data);\n jQuery(\”li a.media-attachment\”).draggable({\n \tcursor: \”move\”,\n helper: function() {\n \tvar selected = jQuery(\”.mg-media-list input:checked\”).parents(\”li\”);\n \tif (selected.length === 0) {\n \t\tselected = jQuery(this);\n \t}\n \tvar container = jQuery(\”<div\/>\”).attr(\”id\”, \”draggingContainer\”);\n \tcontainer.append(selected.clone());\n \treturn container;\n }\n });\n jQuery(\”.media-link\”).droppable( {\n \t accept: \”li a.media-attachment\”,\n \t\thoverClass: \”droppable-hover\”,\n \t\tdrop: handleDropEvent\n });\n },\n error: function (err)\n\t { alert(err.responseText)}\n\t });\n\t});\n<\/script>\n”,”refresh”:true}
    My guess is that this is caused by the PHP version I am using on this site
    MLF and MaxGallery is installed.

    Plugin Author AlanP57

    (@alanp57)

    Ok, thank you Peter.

    Thread Starter grezes71

    (@grezes71)

    I first noticed the problem when using Media Library Folders to upload PDFs. Per your suggestion, I tested using the standard Media feature and got the same problem. I had recently started using MaxGalleria so I disabled MaxGalleria and the PDF upload issue went away. I don’t know why. I don’t know how to log to diagnose the issue. I can work around the problem by disabling MaxGalleria when I upload our newsletter once a month.
    My hosting site just allowed PHP 7.2 (was 7.1). I switched but the issue persists.

    Plugin Author AlanP57

    (@alanp57)

    All right. I am still not able to replicate this issue.

    Peter Smits

    (@psmits1567)

    Hi Grezes71

    Did you add the line define(‘ALLOW_UNFILTERED_UPLOADS’, true);
    Into the WordPress wp-config file as Alan proposed?
    It would be interesting to see if your problem is solved by adding this line
    An other problem might be caused by the contents of the pdf file.
    Could you sent an example pdf that does not work for you. We can perform a test with this file. Maybe it looks like a pdf file but it is not the proper format.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘PDF file type is invalid’ is closed to new replies.