• Hi again
    I have built a custom plugin which needs to upload a .js file into its parent folder. However .js files are nt allowed, can i unrestrict this file type in this plugin only?
    The file being uploaded is a specific file named xmpcfg.js and i would love to be able to restrict the file upload to only files with this exact name?

    Many thaks
    Matt

Viewing 3 replies - 1 through 3 (of 3 total)
  • You should be looking at this filter. https://developer.ww.wp.xz.cn/reference/hooks/upload_mimes/
    But please be notified that uploading of JS file is pretty security risk.

    Thread Starter mattrpm

    (@mattrpm)

    Thank you Nilamber
    You are a savour, and yes you perfectly correct about .js security.
    We are fine with this though as the file is distributed by us just for this plugin which is private, but thank you for mentioning it.

    I dont suppose you would know how to only allow a file upload if it matches an exact name?
    for example: xmpcfg.js
    if it is not xmpcfg.js then do not allow

    Again thanks for all your help

    regards
    Matt

    Sorry no idea about that.

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

The topic ‘Custom Upload Plugin allow restricted file extension’ is closed to new replies.