• Hello,

    This is an issue that expands on this thread: http://wordpress.org/support/topic/plugin-contact-form-7-leave-file-upload-on-server?replies=9

    Which I opened months back in an attempt to allow the “upload” file function to “leave” the field on the server. I’ve been able to successfully achieve this, however, I am running into a new issue.

    When a user uploads a file with the same name, in hopes to replace the old file with the new one, the script simply uploads it to the server, BUT it renames it. For example:

    file.pdf (old that needs to be replaced)
    file1.pdf (latest uploaded file gets renamed)

    In my search to resolve the issue on my own, I’ve come across threads and suggestions that the folders need to have write permission and that the files need to be owned by the same user. I can successfully confirm both of these are correct.

    The folder is 777, the file is 777. What I do not know is who the owner is when the file upload function gets executed.

    See, I have an upload page which a user accesses, then uploads the file. The file is stored on the server has the same ownership with the same owner writes, but the file still gets renamed. For the record, the file being uploaded has the exact same name as the file on the server.

    If anyone can help me “replace” the existing file without renaming it, I would be very grateful.

    Thanks!

    http://wordpress.org/extend/plugins/contact-form-7/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Customizing to leave uploaded files on your server makes a big security hole. I’d never suggest it.

    Thread Starter F C

    (@pmagony)

    Not unless you know how to lock it down. But that’s not what the question is regarding. Thanks for your input.

    Thread Starter F C

    (@pmagony)

    Line 170, of modules/file.php needs to be commented out

    $filename = wp_unique_filename( $uploads_dir, $filename );

    Thanks very much for this, it is quite helpful. Can you share how you are locking it down to prevent a breach in security?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Contact Form 7] Replace Same Name File After Upload’ is closed to new replies.