I have found a bug I think concerning the file upload with FTP. The code is:
Code: Select all
switch ( $t_method ) {
case FTP:
case DISK:
file_ensure_valid_upload_path( $t_file_path );
if ( !file_exists( $t_disk_file_name ) ) {
if ( FTP == $t_method ) {
$conn_id = file_ftp_connect();
file_ftp_put ( $conn_id, $t_disk_file_name, $p_tmp_file );
file_ftp_disconnect ( $conn_id );
}
if ( !move_uploaded_file( $p_tmp_file, $t_disk_file_name ) ) {echo $p_tmp_file.'!!!'. $t_disk_file_name ;
trigger_error( FILE_MOVE_FAILED, ERROR );
}
chmod( $t_disk_file_name, 0400 );
$c_content = '';
} else {
trigger_error( ERROR_FILE_DUPLICATE, ERROR );
}
break;Code: Select all
if ( FTP == $t_method ) {
$conn_id = file_ftp_connect();
file_ftp_put ( $conn_id, $t_disk_file_name, $p_tmp_file );Code: Select all
if ( !move_uploaded_file( $p_tmp_file, $t_disk_file_name ) ) {echo $p_tmp_file.'!!!'. $t_disk_file_name ;
trigger_error( FILE_MOVE_FAILED, ERROR );
}It doesnot matter with apache (no error) but not with IIS. Moreover the function chmod is dangerous.
I make a little correction:
Code: Select all
switch ( $t_method ) {
case FTP:
file_ensure_valid_upload_path( $t_file_path );
if ( !file_exists( $t_disk_file_name ) ) {
if ( FTP == $t_method ) {
$conn_id = file_ftp_connect();
file_ftp_put ( $conn_id, $t_disk_file_name, $p_tmp_file );
file_ftp_disconnect ( $conn_id );
}
} else {
trigger_error( ERROR_FILE_DUPLICATE, ERROR );
}
break;
case DISK:
file_ensure_valid_upload_path( $t_file_path );
if ( !file_exists( $t_disk_file_name ) ) {
if ( !move_uploaded_file( $p_tmp_file, $t_disk_file_name ) ) {echo $p_tmp_file.'!!!'. $t_disk_file_name ;
trigger_error( FILE_MOVE_FAILED, ERROR );
}
chmod( $t_disk_file_name, 0400 );
$c_content = '';
} else {
trigger_error( ERROR_FILE_DUPLICATE, ERROR );
}
break;Only one problem: There is no cache with file uploaded on the webserveur. But I think it is normal because FTP method allows us to have the file on an other server.
cheers