• Hi, I have this code for a plugin I’m using.

    $comment_image_file = wp_upload_bits( $title . $user->user_login . $comment_id . '.' . $file_ext, null, file_get_contents( $_FILES[ $comment_image_id ]['tmp_name'] ) );

    So I can grab the postname ($title) and username ($user->user_login) as part of the uploaded filename no problem.

    However, I really want these variables to be defined as a subfolder before the filename… rather than as part of the filename string.

    In wp_upload_bits it doesn’t seem possible. Is there a way to do it that I don’t know about… ?

The topic ‘wp_upload_bits – define subfolder before filename?’ is closed to new replies.