You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I make a test to upload files with format: Zip, Rar,MSI, Exe, etc and always the file when it's uploaded its modified and then broken when it's downloaded and try to open.
on the other hand if i upload files type text like .txt, .php,.html,.js , etc i don't experiment any problem.
here it's the code example
use std::fs::{read, write};
use std::str;
use std::io::Cursor;
use ftp::FtpStream;
fn main() {
let mut ftp_stream = FtpStream::connect("somehost.com:21").unwrap();
let _ = ftp_stream.login("some_user", "some_password").unwrap();
let read_bytes = read("test_file.rar").unwrap();
let bytes = read_bytes.as_slice();
println!("Total bytes read : {}",read_bytes.iter().count());
let mut reader = Cursor::new(bytes);
let bytes_reader = reader.clone().into_inner();
println!("Totalt bytes after reader {}",bytes_reader.iter().count());
ftp_stream.cwd("public_html").unwrap();
let _ = ftp_stream.put("file.rar", &mut reader);
}
'till this moment i know the problem exist when make the stream of the bytes, 'cause if i write the bytes of the reader on my disk the file it's OK.
So i will check the code of the stream to see what's it's going on.
Tested ON: Windows 10 21H2 and Mac OS Monterrey 12.6
The text was updated successfully, but these errors were encountered:
Please, try with https://github.com/veeso/suppaftp instead, which is the maintained version of this library and set the transfer type to Binary with the transfer_type function
I make a test to upload files with format: Zip, Rar,MSI, Exe, etc and always the file when it's uploaded its modified and then broken when it's downloaded and try to open.
on the other hand if i upload files type text like .txt, .php,.html,.js , etc i don't experiment any problem.
here it's the code example
'till this moment i know the problem exist when make the stream of the bytes, 'cause if i write the bytes of the reader on my disk the file it's OK.
So i will check the code of the stream to see what's it's going on.
Tested ON: Windows 10 21H2 and Mac OS Monterrey 12.6
The text was updated successfully, but these errors were encountered: