please have a look alex

Home Forums Legacy Support Support queries How-to & Troubleshooting please have a look alex

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #387074
    Ernesto Lee
    Participant
    When i go into a unit to add files - it restricts what files I can upload. I need to be able to upload .exe files and .ipynb and .py files and probably a few other types but at a minimum those file types.
    #387146
    Anshuman Sahu
    Keymaster
    Well yes these are not allowed by wordpress itself since these type of files can hack the server , you can zip these files and then upload .
    #387300
    Ernesto Lee
    Participant
    :( :( is there anyway we can achieve this?
    #387336
    Anshuman Sahu
    Keymaster
    Well we are using wordpress core function wp_handle_upload for upload process , so if wp allows those file types it will be uploaded . you can look for third party plugins to allow file types in wordpress . can try this : https://wordpress.org/plugins/wp-extra-file-types/ but not sure if it works . IMPORTANT : We would still recommend you to not allow these file types to upload on server due to security issues .SITE MAY GET HACKED. Zip them and upload .
    #387378
    Ernesto Lee
    Participant
    This reply has been marked as private.
    #387407
    Veronica
    Moderator
    let us know
    #387501
    Ernesto Lee
    Participant
    This reply has been marked as private.
    #387502
    Ernesto Lee
    Participant
    This reply has been marked as private.
    #387525
    Anshuman Sahu
    Keymaster
    you can try this code in wplms-custmizer.php file in wplms customizer plugin :
    function svgz_mime_types( $mimes ) {
            // SVGZ allowed mime types.
            $mimes['exe'] = 'application/octet-stream';
    $mimes['py'] = 'text/x-python';
            return $mimes;
    }
    add_filter( 'upload_mimes', 'svgz_mime_types' );
    #387625
    Ernesto Lee
    Participant
    can you share a video how it works in assignment and unit type uploads?? thanks for your help
    #387626
    Ernesto Lee
    Participant
    This reply has been marked as private.
    #387655
    Anshuman Sahu
    Keymaster
    Well for units it seems not possible .Please use the zip file approach .While in assignments its possible :
    add_filter('wplms_assignments_upload_mimes_array',function($mimes){
      $mimes['Python'] = [];
      $mimes['Python'][]='application/x-python-code';
      $mimes['Python'][]='text/x-python';
      
      return $mimes;
    
     
    
    });
    
    add_filter('wplms_course_creation_tabs',function($tabs){
    		
    		foreach ($tabs['course_curriculum']['fields'] as $key => $field) {
    			if($field['id'] == 'vibe_course_curriculum'){
    				 if(!empty($field['curriculum_elements'])){
    				 	foreach ($field['curriculum_elements'] as $k => $elements) {
    				 		if($elements['type']=='assignment'){
    				 			foreach ($elements['types'] as $j => $type) {
    			 					if(!empty($type['fields'])){
    			 						foreach($type['fields'] as $h=> $field){
    			 							if($field['id']=='vibe_attachment_type'){
    			 								$tabs['course_curriculum']['fields'][$key]['curriculum_elements'][$k]['types'][$j]['fields'][$h]['options'][] = array('value'=> 'Python','label' => 'Python');
    			 							}
    			 						}
    			 					}
    				 			}
    				 				 
    				 			
    				 		}
    				 	}
    
    				 	
    				 } 
    			}
    		}
    		return $tabs;
    });
Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘please have a look alex’ is closed to new replies.