robinrodricks / FluentFTP

An FTP and FTPS client for .NET & .NET Standard, optimized for speed. Provides extensive FTP commands, File uploads/downloads, SSL/TLS connections, Automatic directory listing parsing, File hashing/checksums, File permissions/CHMOD, FTP proxies, FXP support, UTF-8 support, Async/await support, Powershell support and more. Written entirely in C#.
MIT License
3.08k stars 650 forks source link

Upload file: requested action not taken #1641

Closed zagadeka closed 3 weeks ago

zagadeka commented 3 weeks ago

FTP Server OS: Unix

FTP Server Type: Other

Client Computer OS: Unix

FluentFTP Version: 51.0.0

Framework: .NET 8

I am trying to upload a file. For some files the operation is successful. For others, an exception appears. Can you guess what is probably causing the problem? Can I have a better diagnostic than logging FtpStatus.Exception?

Logs :


[2024-09-03 06:38:01 INF] Command:  STOR /LOG/invocatio2.txt
Command:  STOR /LOG/invocatio2.txt
[2024-09-03 06:38:01 DEB] Waiting for response to: STOR /LOG/invocatio2.txt
Status:   Waiting for response to: STOR /LOG/invocatio2.txt
[2024-09-03 06:38:01 INF] Response: 550 Requested action not taken. [56ms]
Response: 550 Requested action not taken. [56ms]
[2024-09-03 06:38:01 DEB] Disposing(async) AsyncFtpClient.FtpSocketStream(data)
Status:   Disposing(async) AsyncFtpClient.FtpSocketStream(data)
[2024-09-03 06:38:01 INF] >         CloseDataStream()

# CloseDataStream()
[2024-09-03 06:38:01 DEB] Error encountered uploading file
Status:   Error encountered uploading file
[2024-09-03 06:38:01 WAR] File failed to upload: upload/728534e7-40ec-4ebc-9c7a-a85fd8feffdc/LOG/invocatio2.txt
Warning:  File failed to upload: upload/728534e7-40ec-4ebc-9c7a-a85fd8feffdc/LOG/invocatio2.txt
[2024-09-03 06:38:01 INF] Skipped:     upload/728534e7-40ec-4ebc-9c7a-a85fd8feffdc/LOG  -->  /LOG/
[2024-09-03 06:38:01 INF] Failed:      upload/728534e7-40ec-4ebc-9c7a-a85fd8feffdc/LOG/invocatio2.txt  -->  /LOG/invocatio2.txt  [!]  Error while uploading the file to the server. See InnerException for more info.
[2024-09-03 06:38:01 INF] Upload file upload/728534e7-40ec-4ebc-9c7a-a85fd8feffdc/LOG/invocatio2.txt
FluentFTP.Exceptions.FtpException: Error while uploading the file to the server. See InnerException for more info.
 ---> FluentFTP.Exceptions.FtpCommandException: Code: 550 Message: Requested action not taken.
   at FluentFTP.AsyncFtpClient.OpenPassiveDataStreamAsync(FtpDataConnectionType type, String command, Int64 restart, CancellationToken token)
   at FluentFTP.AsyncFtpClient.OpenDataStreamAsync(String command, Int64 restart, CancellationToken token)
   at FluentFTP.AsyncFtpClient.OpenWriteInternal(String path, FtpDataType type, Int64 fileLen, Boolean ignoreStaleData, CancellationToken token)
   at FluentFTP.AsyncFtpClient.UploadFileInternalAsync(Stream fileData, String localPath, String remotePath, Boolean createRemoteDir, FtpRemoteExists existsMode, Boolean fileExists, Boolean fileExistsKnown, IProgress`1 progress, CancellationToken token, FtpProgress metaProgress)
   --- End of inner exception stack trace ---
   at FluentFTP.AsyncFtpClient.UploadFileInternalAsync(Stream fileData, String localPath, String remotePath, Boolean createRemoteDir, FtpRemoteExists existsMode, Boolean fileExists, Boolean fileExistsKnown, IProgress`1 progress, CancellationToken token, FtpProgress metaProgress)
   at FluentFTP.AsyncFtpClient.UploadFileFromFile(String localPath, String remotePath, Boolean createRemoteDir, FtpRemoteExists existsMode, Boolean fileExists, Boolean fileExistsKnown, FtpVerify verifyOptions, CancellationToken token, IProgress`1 progress, FtpProgress metaProgress)
   at FluentFTP.AsyncFtpClient.UploadDirectoryFiles(List`1 filesToUpload, FtpRemoteExists existsMode, FtpVerify verifyOptions, IProgress`1 progress, FtpListItem[] remoteListing, CancellationToken token)
[2024-09-03 06:38:01 INF] >         Disconnect()

# Disconnect()
[2024-09-03 06:38:01 INF] Command:  QUIT
Command:  QUIT
[2024-09-03 06:38:01 DEB] Waiting for response to: QUIT
Status:   Waiting for response to: QUIT
FanDjango commented 3 weeks ago

550 Requested action not taken.

Well. One promising google result tells me:

Some old FTP server doesn't support STOR /somefile syntax, you need to set CWD / and only then STOR somefile.

Try that maybe?

FanDjango commented 3 weeks ago

By the way: Think about the FluentFTP client "AutoNavigate" feature to make this "CWD" happen automagically.

zagadeka commented 3 weeks ago

Thank you for your suggestions. In the end it turned out that the server file is an old FAT and doesn't accept names longer than eight plus the extension. The problem is that neither the server nor client logs say much.