• Resolved hliljegren

    (@hliljegren)


    I have a course site where my students are supposed to upload their CSS files in a quiz file upload. I’ve tried both adding:

    define( 'ALLOW_UNFILTERED_UPLOADS', true);

    to my wp-config and also adding the css mime type to senseilms via:

    function mytheme_mime_type($mimes, $question_id){
    	$mimes['css']  = 'text/css';
    	$mimes['html'] = 'text/html';
    	$mimes['psd'] = 'image/vnd.adobe.photoshop';
    	return $mimes;
    }
    add_filter( 'sensei_quiz_answer_file_upload_types', 'mytheme_mime_type', 1, 2 );

    After that, I can upload HTML files in the quiz but CSS files are still not working. When saving the quiz it just says “Quiz saved” but no file is uploaded.

    If I go to the media repository I have no problems uploading css-files.

Viewing 1 replies (of 1 total)
  • Looks like Sensei is not passing the result of this filter to WordPress’s file upload function, and only uses it for an initial check. But there is an additional filter, sensei_file_upload_args, where the the same mime type config can be added in the same format under the ‘mimes’ key, as [ 'mimes' => [ 'css' => 'text/css', ... ] ] — this will be used by the wp_handle_upload call.

Viewing 1 replies (of 1 total)
  • The topic ‘Quiz upload of CSS files’ is closed to new replies.