Comments (3)
Hi,
I would try with stream.transfer_type(FileType::Binary)
from suppaftp.
Hi,
I would try with
stream.transfer_type(FileType::Binary)
There seems to be a new problem after I modified it.:
Error Invalid response: [425] 425 You cannot use PASV on IPv6 connections. Use EPSV instead.
from suppaftp.
I've solved the problem and I think the README can work on it
use std::{fs};
use std::error::Error;
use std::fs::File;
use std::io::{Cursor, Read, Write};
use suppaftp::FtpStream;
use suppaftp::Mode::ExtendedPassive;
use suppaftp::types::FileType;
fn t()-> Result<(),Box<dyn Error>>{
// Create a connection to an FTP server and authenticate to it.
let mut ftp_stream = FtpStream::connect("1127.0.0.1:21")?;
let _ = ftp_stream.login("account", "password")?;
// Binary file transfer is supported
ftp_stream.transfer_type(FileType::Binary)?;
// Support for IPV6
ftp_stream.set_mode(ExtendedPassive);
// Switch ftp service directory
let _ = ftp_stream.cwd("test_data")?;
// put file.
let mut file = fs::read("D:\\img.png")?;
let x = file.as_slice();
let mut cursor = Cursor::new(x);
ftp_stream.put_file("greeting.png",& mut cursor)?;
println!("Successfully wrote greeting.png");
// Terminate the connection to the server.
let _ = ftp_stream.quit();
Ok(())
}
fn main() {
match t() {
Ok(_) => {}
Err(e) => {
println!("Error {}",e)
}
}
}
from suppaftp.
Related Issues (20)
- [BUG] - features are not additive HOT 3
- [Feature Request] - Expose DataStream to users HOT 1
- [Feature Request] - Set a timeout on FTP connect
- [Feature Request] Allow interchangeable use of stream types by exposing ImplFtpStream HOT 5
- [QUESTION] - Reading files when using AsyncFtpStream HOT 2
- [QUESTION] - How to properly use resume_transfer HOT 5
- Problem setting up TLS -> bad server or bad client? HOT 2
- [Feature Request] - Add Send trait to AsyncFtpStream/FtpStream
- [SECURITY] - upgrade chrono->time dependency HOT 1
- [QUESTION] - Is it support download large file? HOT 2
- [BUG] - Async TLS example fails to compile HOT 1
- [BUG] - list method request failed BadResponse HOT 6
- [Feature Request] - OPTS and FEAT commands support
- [BUG] - expected `AsyncNoTlsStream`, found `AsyncNativeTlsStream` HOT 1
- [BUG] - Ftp with TLS (native-tls) Not working HOT 4
- [QUESTION] - 522 SSL connection failed
- [Feature Request] - Build the docs with doc_cfg
- [BUG] - POSIX setgid/setuid/sticky bits not supported
- [Feature Request] - Better composability HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from suppaftp.