Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Shafaet Alam

    (@shafayat-alam)

    Yes, use the following code:

    add_action("wpdm_after_upload_file", function ($path){
        $dir = dirname($path);
        $file = basename($path);
        $_file = explode(".", $file);
        $ext = end($_file);
        $file = str_replace(".{$ext}", "", $file);
        $new_path = $dir.'/'.$file.'_'.wpdm_query_var('package_id', 'int').".{$ext}";
        rename($path, $new_path);
        die("|||".basename($new_path)."|||".$new_path."|||");
    });
    Thread Starter easygees

    (@easygees)

    Thanks for the response. Am getting a number 0 appended to the file name(eg filename_0.jpg) instead of packageID.

    Plugin Contributor Shafaet Alam

    (@shafayat-alam)

    Ops, got it, however, simply keep the code for now, we have adjusted the ID issue, it will be ok from the next update of wpdm.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Append package id to file name during upload’ is closed to new replies.