Closed (fixed)
Project:
IMCE
Version:
7.x-1.7
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Apr 2013 at 17:17 UTC
Updated:
22 Jul 2020 at 18:09 UTC
Jump to comment: Most recent
I have encountered an use case where I need to modify how uploaded files are displayed in the IMCE file uploader dialog: I want to modify the file name and directory of the uploaded file programmatically, and have those changes be displayed in the dialog. Currently, I resorted to modifying the callback method imce_upload_submit in imce.page.inc by inserting $file alter hooks after
/* more code */
$file->uid = $imce['uid']; //global user may not be the owner.
$file->status = FILE_STATUS_PERMANENT;
/// hook_imce_presave_file_alter
drupal_alter('imce_presave_img', $file);
file_save($file);
/* more code */
and a drupal hook
/* more code */
if (isset($form_state['values']['thumbnails']) && img) {
imce_create_thumbnails( /* ... */ );
}
/// hook_imce_file_upload
module_invoke_all('imce_img_upload', $file);
}
Is there a better way to accomplish this?
Please feel free to let me know if you would like more information about what I would like to do.
Knight
Comments
Comment #1
ufku commentedYou may use the hooks fired by file_save and/or alter the upload form to add validate/submit handlers to change the workflow.
Comment #1.0
ufku commentedupdated the pre tags to code
Comment #2
thallesI think this was solved!
Comment #3
thalles