Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was wondering if anyone integrated IMCE with ClamAV virsus scan when uploading files. Has anyone tried this?
Comments
Comment #1
ufku CreditAttribution: ufku commentedCleaning up issue queue.
Comment #2
sambonner CreditAttribution: sambonner commentedHi, is there a reason why this issue has been set to won't fix? I'd be interested to know whether any one has integrated virus scanning into IMCE too.
Thanks,
Sam
Comment #3
ghosty CreditAttribution: ghosty commentedI was able to get virus scanning to work. Go to the /inc folder and look for imce.page.inc. Next, find the imce_upload_submit function. Add these couple lines at the top of the function:
$virus_flag = FALSE;
Then, inside of the first if statement which checks for a saved file upload, I added this:
The rest of the code should then continue with the next line being
//core bug #203204.
. Just remember to close the new if/else statement added right after the//create thumbnails
check.Comment #4
ufku CreditAttribution: ufku commentedThe proper way to do this is to set a validator for imce_upload_form using the form API.
Comment #5
ghosty CreditAttribution: ghosty commentedThat would be better. What is the function call I would use in this case? Let's say my module is called "my_module".
Comment #6
ufku CreditAttribution: ufku commentedYou need to be familiar with forms API. You can alter a form using hook_form_FORM_ID_alter
Comment #7
ghosty CreditAttribution: ghosty commentedSo in this case would it be:
my_module_form_imce_upload_alter(&$form, $form_state)
?