WordPress File Upload plugin supports filters and actions in order to allow programmers to extend its capabilities and perform advanced operations.
The following filters are supported:
wfu_before_frontpage_scripts
It is executed before any front-end scripts and styles are declared and can control which of them will be loaded. It can assist in resolving incompatibilities with other plugins related to jQuery modules, such as the NextGen Gallery plugin. You can use it as follows:
/* This filter runs before the plugin registers frontpage scripts and styles, in order to execute custom configuration. In addition, through this filter, the user can enable some "hidden" plugin settings to resolve incompatibilities and problems with other plugins or themes. For the moment, settings are included for correcting incompatibilities with JQuery UI css and NextGen Gallery plugin. In the future more settings will be added. */ if (!function_exists('wfu_before_frontpage_scripts_handler')) { /** Function syntax * The function takes one parameter, $changable_data. * - $changable_data is an array that can be modified by the filter and * contains the following items: * > correct_JQueryUI_incompatibility: if this item is set to "true", * then adjustments will be performed in the plugin so that it does not * cause incompatibilities with JQuery UI css. * > correct_NextGenGallery_incompatibility: if this item is set to * "true", then adjustments will be performed in the plugin so that it * does not cause incompatibilities with NextGen Gallery plugin. * > exclude_timepicker: if this item is set to "true", then timepicker * element's css and js code will not be loaded * If $changable_data contains the key 'return'value', then no plugin * scripts and styles will be loaded. * The function must return the final $changable_data. */ function wfu_before_frontpage_scripts_handler($changable_data) { // Add code here... return $changable_data; } add_filter('wfu_before_frontpage_scripts', 'wfu_before_frontpage_scripts_handler', 10, 1); }
wfu_before_admin_scripts
It is executed before any back-end scripts and styles are declared. This filter can assist in resolving incompatibilities with other plugins relating to jQuery modules, such as the NextGen Gallery plugin. You can use it as follows:
/* This filter runs before the plugin registers and enqueues admin scripts and styles, in order to execute custom configuration. In addition, through this filter, the user can enable some "hidden" plugin settings to resolve incompatibilities and problems with other plugins or themes. For the moment, settings are included for correcting incompatibilities with JQuery UI css and NextGen Gallery plugin. In the future more settings will be added. */ if (!function_exists('wfu_before_admin_scripts_handler')) { /** Function syntax * The function takes one parameter, $changable_data. * - $changable_data is an array that can be modified by the filter and * contains the following items: * > correct_JQueryUI_incompatibility: if this item is set to "true", * then adjustments will be performed in the plugin so that it does not * cause incompatibilities with JQuery UI css. * > correct_NextGenGallery_incompatibility: if this item is set to * "true", then adjustments will be performed in the plugin so that it * does not cause incompatibilities with NextGen Gallery plugin. * > exclude_codemirror: if this item is set to "true", then codemirror * editor's css and js code will not be loaded * > exclude_datepicker: if this item is set to "true", then datepicker * element's js code will not be loaded * If $changable_data contains the key 'return'value', then no plugin * scripts and styles will be loaded. * The function must return the final $changable_data. */ function wfu_before_admin_scripts_handler($changable_data) { // Add code here... return $changable_data; } add_filter('wfu_before_admin_scripts', 'wfu_before_admin_scripts_handler', 10, 1); }
wfu_before_upload
It is executed before the upload starts, in order to perform any preliminary custom server actions and allow the upload to start or reject it. You can use it as follows:
/* This filter runs before the upload starts, in order to perform any preliminary custom server actions and allow the upload to start or reject it. */ if (!function_exists('wfu_before_upload_handler')) { /** Function syntax * The function takes two parameters, $changable_data and $additional_data. * - $changable_data is an array that can be modified by the filter and * contains the items: * > error_message: initially it is set to an empty value, if the handler * sets a non-empty value then upload will be cancelled showing this * error message * > js_script: javascript code to be executed on the client's browser * right after the filter * - $additional_data is an array with additional data to be used by the * filter (but cannot be modified) as follows: * > sid: this is the id of the plugin, as set using uploadid attribute; * it can be used to apply this filter only to a specific instance of * the plugin (if it is used in more than one pages or posts) * > unique_id: this id is unique for each individual upload attempt * and can be used to identify each separate upload * > files: holds an array with data about the files that have been * selected for upload; every item of the array is another array * with the following items: * >> filename: the filename of the file * >> filesize: the size of the file * The function must return the final $changable_data. */ function wfu_before_upload_handler($changable_data, $additional_data) { // Add code here... return $changable_data; } add_filter('wfu_before_upload', 'wfu_before_upload_handler', 10, 2); }
wfu_before_file_check
It is executed before file is uploaded and before any internal file checks, in order to allow the filter to perform its own checks or change some basic upload parameters, such as filename or userdata. You can use it as follows:
/* This filter runs before the uploaded file is sent to the server and before the plugin executes file validity checks (filename, extension, size etc.). It can be used to perform custom file checks and reject the file if checks fail, or customize the upload file path (or filename) taking into account data from user data fields. */ if (!function_exists('wfu_before_file_check_handler')) { /** Function syntax * The function takes two parameters, $changable_data and $additional_data. * - $changable_data is an array that can be modified by the filter and * contains the items: * > file_path: the full path of the uploaded file * > user_data: an array of user data values, if userdata are activated * > error_message: initially it is set to an empty value, if the handler * sets a non-empty value then upload of the file will be cancelled * showing this error message * > admin_message: initially it is set to an empty value, if the handler * sets a non-empty value then this value will be shown to * administrators if adminmessages attribute has been activated, * provided that error_message is also set. You can use it to display * more information about the error, visible only to admins. * - $additional_data is an array with additional data to be used by the * filter (but cannot be modified) as follows: * > shortcode_id: this is the id of the plugin, as set using uploadid * attribute; it can be used to apply this filter only to a specific * instance of the plugin (if it is used in more than one pages or * posts) * > file_unique_id: this id is unique for each individual file upload * and can be used to identify each separate upload * > file_size: the size of the uploaded file * > user_id: the id of the user that submitted the file for upload * > page_id: the id of the page from where the upload was performed * (because there may be upload plugins in more than one page) * The function must return the final $changable_data. */ function wfu_before_file_check_handler($changable_data, $additional_data) { // Add code here... return $changable_data; } add_filter('wfu_before_file_check', 'wfu_before_file_check_handler', 10, 2); }
wfu_before_file_upload
It is executed right before file is uploaded, in order to allow the filter to change the file name. You can use it as follows:
/* This filter runs right before the uploaded file starts to be uploaded in order to make modifications of its filename. */ if (!function_exists('wfu_before_file_upload_handler')) { /** Function syntax * The function takes two parameters, $file_path and $file_unique_id. * - $file_path is the filename of the uploaded file (after all internal * checks have been applied) and can be modified by the filter. * - $file_unique_id is is unique for each individual file upload and can * be used to identify each separate upload. * The function must return the final $file_path. * If additional data are required (such as user id or userdata) you can * get them by implementing the previous filter wfu_before_file_check and * link both filters by $file_unique_id parameter. Please note that no * filename validity checks will be performed after the filter. The filter * must ensure that filename is valid. */ function wfu_before_file_upload_handler($file_path, $file_unique_id) { // Add code here... return $file_path; } add_filter('wfu_before_file_upload', 'wfu_before_file_upload_handler', 10, 2); }
wfu_after_file_loaded
This filter runs after the file has completely loaded on server. It provides the opportunity to perform custom checks on its contents and reject or accept it. You can use it as follows:
/* This filter runs after every individual file has completely loaded on server. It provides the opportunity to perform custom checks on its contents and reject or accept it. */ if (!function_exists('wfu_after_file_loaded_handler')) { /** Function syntax * The function takes two parameters, $changable_data and $additional_data. * - $changable_data is an array that can be modified by the filter and * contains the items: * > error_message: initially it is set to an empty value, if the handler * sets a non-empty value then upload of the file will be cancelled * showing this error message * > admin_message: initially it is set to an empty value, if the handler * sets a non-empty value then this value will be shown to * administrators if adminmessages attribute has been activated, * provided that error_message is also set. You can use it to display * more information about the error, visible only to admins. * - $additional_data is an array with additional data to be used by the * filter (but cannot be modified) as follows: * > file_unique_id: this id is unique for each individual file upload * and can be used to identify each separate upload * > file_path: the full path of the uploaded file * > shortcode_id: this is the id of the plugin, as set using uploadid * attribute; it can be used to apply this filter only to a specific * instance of the plugin (if it is used in more than one pages or * posts) * The function must return the final $changable_data. */ function wfu_after_file_loaded_handler($changable_data, $additional_data) { // Add code here... return $changable_data; } add_filter('wfu_after_file_loaded', 'wfu_after_file_loaded_handler', 10, 2); }
wfu_before_email_notification
It is executed before email notification is sent, in order to allow advanced checks or modifications to the email. You can use it as follows:
/* This filter runs after file upload has finished and right before the notification email is sent (if email notifications are enabled). It allows to customize the email contents, taking also into account any user data. */ if (!function_exists('wfu_before_email_notification_handler')) { /** Function syntax * The function takes two parameters, $changable_data and $additional_data. * - $changable_data is an array that can be modified by the filter and * contains the items: * > recipients: the list of recipients (before dynamic variables are * applied) * > subject: the email subject (before dynamic variables are applied) * > message: the email body (before dynamic variables are applied) * > headers: the email headers, if exist (before dynamic variables are * applied) * > user_data: an array of user data values, if userdata are activated * > filename: a comma separated list of uploaded file names (only the * file names) * > filepath: a comma separated list of uploaded file paths (absolute * full file paths) * > error_message: initially it is set to an empty value, if the handler * sets a non-empty value then email sending will be cancelled showing * this error message (message will be shown only to administrators if * adminmessages attribute has been activated) * - $additional_data is an array with additional data to be used by the * filter (but cannot be modified) as follows: * > shortcode_id: this is the id of the plugin, as set using uploadid * attribute; it can be used to apply this filter only to a specific * instance of the plugin (if it is used in more than one pages or * posts) * The function must return the final $changable_data. */ function wfu_before_email_notification_handler($changable_data, $additional_data) { // Add code here... return $changable_data; } add_filter('wfu_before_email_notification', 'wfu_before_email_notification_handler', 10, 2); }
wfu_after_file_upload
It is executed after the upload process for each individual file has finished, in order to allow additional tasks to be executed and define custom javascript code to run in client’s browser. You can use it as follows:
/* This filter is executed after the upload process for each individual file has finished, in order to allow additional tasks to be executed and define custom javascript code to run in clientâ s browser. */ if (!function_exists('wfu_after_file_upload_handler')) { /** Function syntax * The function takes two parameters, $changable_data and $additional_data. * - $changable_data is an array that can be modified by the filter and * contains the items: * > ret_value: not used for the moment, it exists for future additions * > js_script: javascript code to be executed on the client's browser * after each file is uploaded * - $additional_data is an array with additional data to be used by the * filter (but cannot be modified) as follows: * > shortcode_id: this is the id of the plugin, as set using uploadid * attribute; it can be used to apply this filter only to a specific * instance of the plugin (if it is used in more than one pages or * posts) * > file_unique_id: this id is unique for each individual file upload * and can be used to identify each separate upload * > upload_result: it is the result of the upload process, taking the * following values: * success: the upload was successful * warning: the upload was successful but with warning messages * error: the upload failed * > error_message: contains warning or error messages generated during * the upload process * > admin_messages: contains detailed error messages for administrators * generated during the upload process * The function must return the final $changable_data. */ function wfu_after_file_upload_handler($changable_data, $additional_data) { // Add code here... return $changable_data; } add_filter('wfu_after_file_upload', 'wfu_after_file_upload_handler', 10, 2); }
wfu_after_upload
It is executed after the upload completely finishes, in order to perform any final custom server actions. You can use it as follows:
/* This filter runs after the upload completely finishes, in order to perform any final custom server actions. */ if (!function_exists('wfu_after_upload_handler')) { /** Function syntax * The function takes two parameters, $changable_data and $additional_data. * - $changable_data is an array that can be modified by the filter and * contains the items: * > js_script: javascript code to be executed on the client's browser * right after the filter; the script can check upload_status variable * for checking if upload has succeeded or not and mode variable for * checking if it was an AJAX or classic upload. * - $additional_data is an array with additional data to be used by the * filter (but cannot be modified) as follows: * > sid: this is the id of the plugin, as set using uploadid attribute; * it can be used to apply this filter only to a specific instance of * the plugin (if it is used in more than one pages or posts) * > unique_id: this id is unique for each individual upload attempt * and can be used to identify each separate upload * > files: holds an array with final data about the files that have been * uploaded (or failed); every item of the array is another array with * the following items: * >> file_unique_id: a unique id identifying every individual file * >> original_filename: the original filename of the file * >> filepath: the final path of the file (including the filename) * >> filesize: the size of the file * >> user_data: an array of user data values, if userdata are * activated, having the following structure: * >>> label: the label of the user data field * >>> value: the value of the user data fields entered by user * >> upload_result: it is the result of the upload process, taking * the following values: * success: the upload was successful * warning: the upload was successful but with warning messages * error: the upload failed * >> error_message: contains warning or error messages generated * during the upload process * >> admin_messages: contains detailed error messages for * administrators generated during the upload process * The function must return the final $changable_data. */ function wfu_after_upload_handler($changable_data, $additional_data) { // Add code here... return $changable_data; } add_filter('wfu_after_upload', 'wfu_after_upload_handler', 10, 2); }
wfu_browser_check_file_action
It is executed when the user attempts to download or delete a file of the front-end file viewer, in order to determine if the action will be accepted. You can use it as follows:
/* This filter runs when the user attempts to download or delete a file of the front-end file viewer, in order to determine if the action will be accepted. */ if (!function_exists('wfu_browser_check_file_action_handler')) { /** Function syntax * The function takes two parameters, $changable_data and $additional_data. * - $changable_data is an array that can be modified by the filter and * contains the items: * > error_message: initially it is set to an empty value, if the handler * sets a non-empty value then the download or delete action of the * user will be rejected showing this error message * - $additional_data is an array with additional data to be used by the * filter (but cannot be modified) as follows: * > file_action: the action attempted by the user (download or delete) * > filepath: the full path of the file * > uploaduser: the ID of the user who uploaded the file * > userdata: an array of user data values, if userdata are activated, * having the following structure: * >> label: the label of the user data field * >> value: the value of the user data fields entered by user * The function must return the final $changable_data. */ function wfu_browser_check_file_action_handler($changable_data, $additional_data) { // Add code here... return $changable_data; } add_filter('wfu_browser_check_file_action', 'wfu_browser_check_file_action_handler', 10, 2); }
wfu_file_browser_edit_column-{$column}
It is executed before the front-end file viewer renders in order to customize its columns. You can use it as follows:
/* This filter enables to edit the contents of the file viewer columns, so that they can be fully customized. The {$column} variable in the filter name needs to be replaced by the column name that is to be editted. The filter function takes 3 parameters, the cell contents that are editable by the function, file information and additional info. */ if (!function_exists('wfu_file_browser_edit_column_handler')) { /** Function syntax * The function takes three parameters, $cell, $file and $additional_data. * - $cell is an array that can be modified by the filter and contains the * items: * > contents: the contents that the column cell will have for the * specific file; initially it is takes the default value generated by * the plugin * > sort_value: this is the value that will be used to sort the column * if it is sortable * - $file is an array with information about the specific file; it * contains the following properties: * > name: the file name * > fullpath: the full path of the file * > size: the file size * > mdate: the date of last modification of the file * > filedata: the database object holding upload information about the * file * > deletable: a flag (true or false) determining whether the file can * be deleted by the user who views the file viewer * - $additional_data is an array with additional information; it contains * the following properties: * > bid: the ID if the specific file viewer * > column_sortable: a flag (true or false) determining whether the * column is sortable * > params: an array holding the shortcode parameters of the file viewer * The function must return the final $cell. */ function wfu_file_browser_edit_column_handler($cell, $file, $additional_data) { // Add code here... return $cell; } add_filter('wfu_file_browser_edit_column-{$column}', 'wfu_file_browser_edit_column_handler', 10, 3); }
I have minimum HTML experience, and I am not sure how to make the plugin send an email notification to the following addresses that files have been uploaded.
Can you tell me how I can do this with this plugin?
Hi, please read this article for configuring email notifications
Is it possible to perform an action on the file that was uploaded by extending the Plugin using the wfu_after_upload filter function? For example, alter the file in some way with a Linux command? I am new to filter functions. If this is possible, would I place the filter function in a separate self-written plugin?
Hi, yes it is possible. The Pro version has a Code Hook area where you can write filters without any extra plugins. If you have the free version, then you can use a third party plugin called Code Snippets to write the filter, or you can put the code in wp_functions.php of your website.
So, is it not possible to create a separate plugin using the code you have listed for wfu_after_upload above using your free plugin? I have been trying that, but it doesn’t seem to execute the code. Does the free plugin not support this scenario?
The free versions supports wfu_after_upload filter. However it does not include the Code Hook feature. So, you have 2 ways of implementing the filter with the code I provided:
1. Install another plugin, called Code Snippets, which is used to implement filters and actions. After you install it, you create a new Snippet and you put the php code in there (it is very similar to Code Hooks feature of the Pro version).
2. Add the php code inside wp_functions.php file of your WordPress website. However this requires that you know how to edit php files.
Nickolas
Is there an option to send one mail per recipient in the list instead of sending one mail with all recipients in one to: – field in one mail?
If yes, how?
Sincerely,
– Frank.
I am not sure what you mean, however the plugin has a filter, wfu_before_email_notification, with which you can do a lot of tweaking in the email notification and configure it as you want
Nickolas
As far as I can tell, the wfu_after_upload filter isn’t applied at all if you’re uploading in AJAX mode. In fact, the surrounding function in wordpress_file_upload.php apparently wasn’t being called at all. The filter worked once I disabled AJAX, though.
Hi, what Scope have you set in the hook?
Not sure what you mean by that. But I filled the big function that applied the filter with debug statements (in wordpress_file_upload.php), and none of them ran until I turned off AJAX, so it wasn’t a problem with the hook itself.
How did you create the filter? Using the Hook tab in the plugin’s area in Dashboard?
No, I’m adding the filter in the same must-use plugin file I use for all my hooks, and I added the callback as an anonymous function. Works fine, but only when I turn off AJAX. I didn’t try adding it with that “Custom css-js-php” plugin you mentioned in another article.
I’m stuck on PHP 5.3 fyi, perhaps that had something to do with it. Need any more details?
Hi, I’m trying to add new hook using the “Edit Hook” interface in the Pro version.
I got an error massage: “Hook has been saved but cannot be activated because the code contains errors. Please check its syntax.”
I’ve selected the “Everywhere” scope. I tried both AJAX and No AJAX options with the same error.
Do you need more details?
cf. sample script.
if (!function_exists(‘wfu_after_upload_handler’)) {
function wfu_after_upload_handler($changable_data, $additional_data) {
// Add code here…
return $changable_data;
}
add_filter(‘wfu_after_upload’, ‘wfu_after_upload_handler’, 10, 2);
}
Dear Nickolas,
Im still struggling with the WordPress File Upload.
After several experiments I found that:
-When the AJAX is disabled the multiple files upload is not possible.
-When the AJAX is not disabled the hook filter is not applicable.
What I need is multiple file upload and hook filter applicable. Is it possible? How?
Many thanks in advance,
I want to add filter but when i add the code in functions.php it gives me error “Undefined end of file.”
When i put it in you plugin it also give me error.
Plz guide me.
I want to load file-upload-pro css and js only on one specific page called “/filetransfer” not on the whole site. How ould I reach this using wfu_before_frontpage_scripts?
In the changelog, you write:
“added option to allow loading of plugin’s styles and scripts on the front-end only for specific posts/pages through wfu_before_frontpage_scripts filter”
Hi, you need to create a plugin hook and implement wfu_before_frontpage_scripts filter. Here is how (provided you have the Pro version):
1. Go to Dashboard / Settings / WordPress File Upload / Hooks and add a new hook.
2. Give it any title you want.
3. Put the following code inside the code box:
if (!function_exists('wfu_before_frontpage_scripts_handler')) {
function wfu_before_frontpage_scripts_handler($changable_data) {
global $post;
if ( $post->ID != "000" ) $changable_data["return_value"] = 0;
return $changable_data;
}
add_filter('wfu_before_frontpage_scripts', 'wfu_before_frontpage_scripts_handler', 10, 1);
}
4. Change 000 to the ID of the page you want the scripts to load.
5. Set Status to Active and Save.
You are done.
Regards
Nickolas
Ok, understood… but if I add this to a new hook in the plugin (3.9.6 pro) it allways tells me:
“Hook has been saved but cannot be activated because the code contains errors. Please check its syntax.”
If I add it to my functions.php, it works perfectly.
Even, if I add the code vie the “Add code” button in the hook editor, it tells me, the syntax was wrong.
The Hooks functionality of the plugin has an internal function that checks the code for errors before activation, because erroneous code may break the website. Some web servers do not allow this internal check function to operate , so it seems like the code has errors (but it doesn’t actually).
To resolve this problem, there is an option in plugin’s Settings, ModSecurity Restrictions that ignores the internal check and the hook is saved without errors.
Regards
Nickolas
Hello 🙂
i want to set the email “From: ” via the ‘wfu_before_email_notification’ filter.
Does not work :/
Heres my code:
if (!function_exists('wfu_before_email_notification_handler')) {
function wfu_before_email_notification_handler($changable_data, $additional_data) {
if ( $additional_data["shortcode_id"] == "1" )
$changable_data["headers"] = 'From: ' . user_data[5] . '';
return $changable_data;
}
add_filter('wfu_before_email_notification', 'wfu_before_email_notification_handler', 10, 2);
}
Maybe someone has a solution?
Hi, you are almost correct. You need to replace
user_data[5]
with$changable_data["user_data"][5]["value"]
Nickolas
Thank you very much for the tipps Nickolas, here is my final and working solution:
if (!function_exists('wfu_before_email_notification_handler')) {
function wfu_before_email_notification_handler($changable_data, $additional_data) {
if ( $additional_data["shortcode_id"] == "1" )
$changable_data["headers"] = 'From: Bewerber ';
return $changable_data;
}
add_filter('wfu_before_email_notification', 'wfu_before_email_notification_handler', 10, 2);
}
I am happy now, thx 🙂
Sorry it killes html tags here.
After “From: Bewerber” comes:
. $changable_data["user_data"][4]["value"]
Sorry I do not understand, what do you mean?
Nickolas
i meant that i cant post html tags here 🙂
New question:
i want to display the names of files that failed to upload in email notification. But email is always complete empty.
Here’s what i have:
function wfu_before_email_notification_handler($changable_data, $additional_data) {
if ( $additional_data["shortcode_id"] == "1" ) {
$changable_data["message"] = $changable_data["message"]["value"] . $changable_data["error_message"]["value"];
}
return $changable_data;
}
add_filter('wfu_before_email_notification', 'wfu_before_email_notification_handler', 10, 2);
Many thx in advance, Andre 🙂
Problem solved here:
https://www.iptanus.com/wordpress-plugins/wordpress-file-upload/#comment-26275
Hello,
I recently purchase pro version 4.3.1. I have the plugin working however I am trying to get after upload filters to trigger and am having trouble. I have added a hook, through settings, by copying from the template for wfu_after_file_upload_handler and in the ‘insert code here section’ added a simple echo and print statement. The hook is active and has no other conditions. The hook never seems to trigger. What other areas might I look at?
Craig
Hi Craig, please send me the hook to my email info@iptanus.com
Regards
Nickolas
Hi Nickolas,
I am having the samer issue as Craig had on the 21st of March but cannot find the response you finally gave.
if (!function_exists(‘wfu_before_upload_handler’)) {
function wfu_before_upload_handler($changable_data, $additional_data) {
// Add code here…
echo “additional data \n”;
//print_r $additional_data;
return $changable_data;
}
add_filter(‘wfu_before_upload’, ‘wfu_before_upload_handler’, 10, 2);
}
Cheers,
Paul
Hello,
1) I would like to create a private page where the admin approves the images uploaded by the users, is it possible?
2) Is there any way to edit the message after the file has been loaded, or modify the message?
3) when loading is it possible to give a category to the file?
Hi, here are answers:
1. Admin moderation is not supported. What exactly do you want to do?
2. Yes, open the visual editor of the shortcode, in Labels tab you can change success, warning, error messages etc.
3. Probably yes using a plugin’s filter, what do you mean category?
Regards
Nickolas
ok,
Thanks for the reply,
1) create a page where, before the image file is published, the moderator approves the file and is published in generic gallery.
2) ok, but can the user change?
3) example, 3 types of fruit vegetables and meat category, the image is combined with a category, a multiple choice combobox.
Hi, unfortunately moderation of this kind is not supported.
Regarding 2) why let the user change the message?
and 3) yes this can be done with plugin filters
Regards
Nickolas
Hi,
Great plugin, thank you….just working through getting it working for the customizations I want.
Ran into an issue that’s got me a little confused in the wfu_before_file_check_handler hook
Trying to change the filename but the file/path changes never take. What am I doing wrong?
Thanks for the help.
$myfile = basename($changable_data[“file_path”]);
$mydir = dirname($changable_data[“file_path”]);
$changeable_data[“file_path”] = $mydir.”/111/”.$myfile;
=====
$changeable_data[“file_path”] is always the same as when passed into the function…never seems to update.
Thanks
Rob
Hi, how is your shortcode? Do you have medialink or postlink attributes active?
Regards
Nickolas
Hi Nickolas, I would like to know if there is a way to integrate a Google Ads snippet for tracking conversions, triggered by the submit button of the form. Maybe from the Hooks panel?
Thanks for the reply.
Hi Nikolas – what hook/code (PHP) should I use to dynamically specify the upload folder for the files to be uploaded? I would like to replace the default value for the “uploadpath” attribute based on the user and company values I have in the form fields that triggers the file upload, e.g. “uploads/user1/ABC_company/”. I’m using the Pro version of the plugin. Thanks for your help.
Hi, maybe you do not need a hook. Supposie that the 1st field in your form is user and 2nd field is company. Set upload path like this: uploads/%userdata1%/%userdata2%/
Regards
Nickolas
Hi Nicolas
How can I style the progress bar?
Please send me a link to some documentation.
Best,
Ralph
Hi Ralph, which sidebar do you mean? Can you send me a screenshot at nickboss@iptanus.com?
Regards
Nickolas
Hi, after I upload an image with the wordpress file plugin, can I just set the value of the filename to a textbox on the page without reloading or redirecting? Is it required that I use the wfu_after_upload to do such a thing? And if so how? I put my ajax stuff in functions.php of the theme, can the filter go there? If so, how do I call the filter from my javascript on the page with the uploader control? Thanks.
Hi, your plugin looks great – I was wondering if something is possible with the pro version of WordPress File Upload Plugin: Would we be able to upload a large number of PDF files at once and have them automatically separated for different users (and only accessible to those specific users) based on something like a username or user number in the beginning of the file name? Perhaps there is a hook that we could customize to allocate files to separate users as we bulk upload files? Basically we just want to upload a bulk amount of PDF files at once and have them separated into user accounts, and perhaps even customize a hook to send an email to users to let them know new files have been uploaded for them. Please let me know if this might be possible, thanks.
Hi, this is possible by using the filters of the plugin and some customization. Please send me an email at nickboss@iptanus.com for details.
Regards
Nickolas
Hi Nickolas,
I have been asked to create a page which will have multiple dynamic buttons to upload files. One button per image.
The challenge is they don’t want the files uploaded to the server until the form is submitted as there can be multiple files and some other fields are mandatory.
Is there a way to save the image to a hidden field as string64 image? If this is possible we can wait until all the required fields plus required images are completed. Upon submission of the form then we can do the work on the back end to save the images to the right folder and their metadata in our DB.
Hi Nick,
I’m using your Pro version
I have a ‘post summary page’ that lists a collection of posts (using an JetEngine Listing and Elementor).
I want users to be able to upload files on this summary page but I need to know the post_id that the file upload is related to in the wfu_after_file_upload hook so I can do some additional reporting with that information.
I can’t see how I can pass this information into that hook. Please can you advise.
Thanks
Hi Nick,
I just noticed that the wfu_after_upload_handler is triggered even if the file type is filtered (not allowed) via the uploadpatterns.
Is there a way to prevent this HOOK to fire on invalid file types?
If not what can I do inside the wfu_after_upload_handler hook to exit the function immediately.
Regards
Roberto Tijerino
Is there anyway to add other user roles to the file browser? For example something like:
add_filter(‘wordpress_file_upload’, function($capability) {
return ‘edit_pages’;
});