unlink( $tempfile );
return false;
}
-
+
if ( ! @ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) {
fclose( $temp );
unlink( $tempfile );
return false;
}
-
+
fseek( $temp, 0 ); // Skip back to the start of the file being written to
$contents = '';
public function put_contents($file, $contents, $mode = false ) {
$tempfile = wp_tempnam($file);
$temp = fopen( $tempfile, 'wb+' );
- if ( ! $temp )
+
+ if ( ! $temp ) {
+ unlink( $tempfile );
return false;
+ }
mbstring_binary_safe_encoding();