Ah! Here’s the code’s part of the plugin responsible for the upload/removing files from the server:
/* File uploading functions */
function wpcf7_init_uploads() {
$dir = wpcf7_upload_tmp_dir();
wp_mkdir_p( trailingslashit( $dir ) );
@chmod( $dir, 0733 );
$htaccess_file = trailingslashit( $dir ) . ‘.htaccess’;
if ( file_exists( $htaccess_file ) )
return;
if ( $handle = @fopen( $htaccess_file, ‘w’ ) ) {
fwrite( $handle, “Deny from all\n” );
fclose( $handle );
}
}
function wpcf7_upload_tmp_dir() {
if ( defined( ‘WPCF7_UPLOADS_TMP_DIR’ ) )
return WPCF7_UPLOADS_TMP_DIR;
else
return wpcf7_upload_dir( ‘dir’ ) . ‘/wpcf7_uploads’;
}
function wpcf7_cleanup_upload_files() {
$dir = trailingslashit( wpcf7_upload_tmp_dir() );
if ( ! is_dir( $dir ) )
return false;
if ( ! is_readable( $dir ) )
return false;
if ( ! wp_is_writable( $dir ) )
return false;
if ( $handle = @opendir( $dir ) ) {
while ( false !== ( $file = readdir( $handle ) ) ) {
if ( $file == “.” || $file == “..” || $file == “.htaccess” )
continue;
$stat = stat( $dir . $file );
if ( $stat[‘mtime’] + 60 < time() ) // 60 secs
@chmod( $dir . $file, 0755 );
@unlink( $dir . $file );
}
closedir( $handle );
}
}
if ( ! is_admin() && ‘GET’ == $_SERVER[‘REQUEST_METHOD’] )
wpcf7_cleanup_upload_files();
if you know some compatibility problem with this kind of function with your theme or something.
I don’t know of any. There’s absolutely nothing on the theme that has anything to do with handling server files.
Suggestions:
– Check all the custom code you have added on the theme both on template files and on functions.php. You may have added something previously that might be the cause.
– Just try deactivating plugins. I’ve read your post on the plugin page where you mentioned that you did not even try since you managed to make it work the first time.
– Set debug to true on your wp-config file so that error messages are displayed if there are any. Better yet, check your server log files to see any error messages there.
– Check your code again, especially the function wpcf7_cleanup_upload_files()
. There seems to be some opening and closing brackets that are missing.
Ok, thanks for the suggestions!
I’ll try this steps and then I’ll post here the results!
Thank you again!
Problem solved!
The cause was a plugin that I was not even using!
Thank you!