How to save an uploaded file on the server with latest CF7?
-
Hello,
I have updated to the latest CF7 version and now my “save on server” hack doesn’t work anymore. The file upload feature works as expected, a file is attached to an email. But in my case I like to have the file not to be deleted from the server
I noticed modules/file.php has been rewritten, amongst other files.
Anyway, in the past I just out commented
//@unlink( $dir . $file );
on line 346 in file.phpNow with the latest file.php I have tried to out comment
//wpcf7_rmdir_p( path_join( $dir, $file ) );
on line 391 in file.phpalso I tried to outcomment line 172 in includes/submission.php
//$this->remove_uploaded_files();/
without any luck?What could be a solution to have the uploaded file stored in the upload folder
Disclaimer: I am aware of the security risk by saving a file on the server as Takayuki. But in this case I have only trusted users and I am on localhost network.
[EDIT] A nicer way would be a function hook where we copy the uploaded file to a specified destination before deleting. So I don’t have to alter the CF7 sourcecode
- The topic ‘How to save an uploaded file on the server with latest CF7?’ is closed to new replies.