WordPress.org

Ready to get started?Download WordPress

Forums

update options and wp_unique_filename (1 post)

  1. baylock
    Member
    Posted 1 year ago #

    Hello,

    I was able to temporarily disable an automatic task of wordpress during a specific file type upload which is nice. For instance, I changed the usual upload path for the pdf uploads by doing this:

    //change the normal path
    update_option('upload_path','wp-content/uploads/attachments/'.$id);
    //upload the file
    $upload = wp_upload_bits($pdffile,null,file_get_contents($pdffile_temp));
    //get the standard path back
    update_option('upload_path','');

    Now I would like to do the same with the "wp unique filename" function that is automatically called by wordpress. The same way I changed temporarily the path for this specific upload routine, I would like not to rename the file if another one has already the same name inside the target folder (I would rather overwrite the old file with the new one instead).

    How could I do that?

    Thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic