Title: Execute JS after upload
Last modified: August 24, 2016

---

# Execute JS after upload

 *  [nicoromano](https://wordpress.org/support/users/nicoromano/)
 * (@nicoromano)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/execute-js-after-upload/)
 * Is there a way to execute some JS after file upload is complete?
 * What I would like to do is: user uploads a file, then the uploader disappears
   and is replaced with a div showing the file name.
 * What is the best way to achieve this?
 * [https://wordpress.org/plugins/wp-file-upload/](https://wordpress.org/plugins/wp-file-upload/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/execute-js-after-upload/#post-5985629)
 * Hi,
 *  this is not currently implemented, it is scheduled for a future release.
 *  You need to do some coding by your own by changing the plugin code. I can help
   you with that if you want.
 * Nickolas
 *  Thread Starter [nicoromano](https://wordpress.org/support/users/nicoromano/)
 * (@nicoromano)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/execute-js-after-upload/#post-5985630)
 * Hi Nickolas,
 * thanks for your answer. If you could point me in the right direction I would 
   be happy to do some coding!
 * cheers
    Nico
 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/execute-js-after-upload/#post-5985672)
 * Open file wordpress_file_upload_functions.js found inside /js folder of the plugin
   directory, using a text editor.
 * Locate the line that has the string: “wfu_clear(evt.target.shortcode_id);” (without
   the quotes)
 * Add the following right below that line:
 *     ```
       if (GlobalData[sid].upload_state == 4 || GlobalData[sid].upload_state == 5) {
       			var fname = document.getElementById('wfu_messageblock_header_' + sid + '_label_1').innerHTML;
       			fname = fname.replace('File ', '').replace(' uploaded successfully', '');
       			document.getElementById('wordpress_file_upload_block_' + sid).innerHTML = '<label style="font-weight:bold;">' + fname + '</label>';
       		}
       ```
   
 * Save the file and reload the page. When you upload a file, the plugin will be
   replaced by the filename.
 * This code should work in free and Pro versions.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Execute JS after upload’ is closed to new replies.

 * ![](https://ps.w.org/wp-file-upload/assets/icon-256x256.png?rev=3252590)
 * [Iptanus File Upload](https://wordpress.org/plugins/wp-file-upload/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-file-upload/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-file-upload/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-file-upload/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-file-upload/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-file-upload/reviews/)

## Tags

 * [event](https://wordpress.org/support/topic-tag/event/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 3 replies
 * 2 participants
 * Last reply from: [nickboss](https://wordpress.org/support/users/nickboss/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/execute-js-after-upload/#post-5985672)
 * Status: not resolved