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
Hello
I use ftpconnect for a simple upload and download programme and always get the error 425.
The connection can be established but as soon as the data is to be uploaded, this is not accepted. It seems that the server requires the reuse of TLS.
Here is my code and the error log.
Thank you very much for your support.
Hello
I use ftpconnect for a simple upload and download programme and always get the error 425.
The connection can be established but as soon as the data is to be uploaded, this is not accepted.
It seems that the server requires the reuse of TLS.
Here is my code and the error log.
Thank you very much for your support.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:ftpconnect/ftpconnect.dart';
import 'package:path_provider/path_provider.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('FTP Upload Beispiel'),
),
body: Center(
child: ElevatedButton(
onPressed: () async {
await uploadFile();
},
child: const Text('Datei hochladen'),
),
),
),
);
}
}
Future _log(String log) async {
print(log);
await Future.delayed(const Duration(seconds: 1));
}
Future uploadFile() async {
const host = 'xxxx.ch'; // Ersetze durch deine FTP-Serveradresse
const user = 'xxxx-hoh'; // Ersetze durch deinen FTP-Benutzernamen
const pass = '******'; // Ersetze durch dein FTP-Passwort
const port = 21; // Standard FTP-Port
await _log('Connecting to FTP ...');
FTPConnect ftpConnect = FTPConnect( // Use secure constructor
host,
user: user,
pass: pass,
port: port,
timeout: 30000,
securityType: SecurityType.FTPES, //SecurityType { FTP, FTPS, FTPES }
showLog: true,
);
try {
bool connectResult = await ftpConnect.connect();
if (connectResult) {
print('Verbunden mit FTP-Server (SSL/TLS aktiviert)');
} catch (e) {
print('Fehler: $e');
} finally {
await ftpConnect.disconnect();
}
}
Error Log:
I/flutter ( 7889): Connecting to FTP ...
I/flutter ( 7889): [2024-08-26 18:33:50.800789] Connecting...
I/flutter ( 7889): [2024-08-26 18:33:50.868789] Connection established, waiting for welcome message...
I/flutter ( 7889): [2024-08-26 18:33:51.178029] < FTPReply = [code= 220, message= 220 ::ffff:80.237.133.94 FTP server ready]
I/flutter ( 7889): [2024-08-26 18:33:51.178658] > AUTH TLS
I/flutter ( 7889): [2024-08-26 18:33:51.483952] < FTPReply = [code= 234, message= 234 AUTH TLS successful]
I/flutter ( 7889): [2024-08-26 18:33:51.529613] > PBSZ 0
I/flutter ( 7889): [2024-08-26 18:33:51.834290] < FTPReply = [code= 200, message= 200 PBSZ 0 successful]
I/flutter ( 7889): [2024-08-26 18:33:51.834714] > PROT P
I/flutter ( 7889): [2024-08-26 18:33:52.137704] < FTPReply = [code= 200, message= 200 Protection set to Private]
I/flutter ( 7889): [2024-08-26 18:33:52.138063] > USER xxxx-hoh
I/flutter ( 7889): [2024-08-26 18:33:52.443307] < FTPReply = [code= 331, message= 331 Password required for xxxx-hoh]
I/flutter ( 7889): [2024-08-26 18:33:52.443790] > PASS ******
I/flutter ( 7889): [2024-08-26 18:33:53.360109] < FTPReply = [code= 230, message= 230 User ftp12195832-hoh logged in]
I/flutter ( 7889): [2024-08-26 18:33:53.360333] Connected!
I/flutter ( 7889): Verbunden mit FTP-Server (SSL/TLS aktiviert)
I/flutter ( 7889): Inhalt der Datei: mein Upload Test
I/flutter ( 7889): [2024-08-26 18:33:53.382827] > PASV
I/flutter ( 7889): [2024-08-26 18:33:53.686074] < FTPReply = [code= 227, message= 227 Entering Passive Mode (80,237,133,94,208,166).]
I/flutter ( 7889): [2024-08-26 18:33:53.686643] > TYPE I
I/flutter ( 7889): [2024-08-26 18:33:53.988652] < FTPReply = [code= 200, message= 200 Type set to I]
I/flutter ( 7889): [2024-08-26 18:33:53.990963] Upload File: /data/user/0/com.example.ftp_test/app_flutter/Uploadtext.txt
I/flutter ( 7889): [2024-08-26 18:33:53.991563] > PASV
I/flutter ( 7889): [2024-08-26 18:33:54.293050] < FTPReply = [code= 227, message= 227 Entering Passive Mode (80,237,133,94,202,197).]
I/flutter ( 7889): [2024-08-26 18:33:54.302116] > STOR Uploadtext.txt
I/flutter ( 7889): [2024-08-26 18:33:54.302900] Opening DataSocket to Port 51909
I/flutter ( 7889): [2024-08-26 18:33:54.631179] < FTPReply = [code= 150, message= 150 Opening BINARY mode data connection for Uploadtext.txt]
I/flutter ( 7889): [2024-08-26 18:33:54.631515] Start uploading...
I/flutter ( 7889): [2024-08-26 18:33:54.951959] < FTPReply = [code= 425, message= 425 Unable to build data connection: Operation not permitted]
I/flutter ( 7889): Fehler beim Hochladen der Datei: FTPConnectException: Transfer Error. (Response: 425 Unable to build data connection: Operation not permitted)
I/flutter ( 7889): [2024-08-26 18:33:54.953107] Disconnecting...
I/flutter ( 7889): [2024-08-26 18:33:54.953552] > QUIT
I/flutter ( 7889): [2024-08-26 18:33:55.256331] < FTPReply = [code= 221, message= 221 Goodbye.]
I/flutter ( 7889): [2024-08-26 18:33:55.259960] Disconnected!
The text was updated successfully, but these errors were encountered: