question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

calling UploadFile for large file got exception with message "You cannot modify the position of a FtpDataStream. This property is updated as data is read or written to the stream."

See original GitHub issue

FTP OS: not sure, probably Unix, the server is provided by GoDaddy: https://en.wikipedia.org/wiki/GoDaddy

FTP Server: not sure

Computer OS: ? Windows 7

<write details about your bug report / feature request here> I try to upload a big file (about 1.5GB) by FtpClient.UploadFile, but it always throws exception with the message: “You cannot modify the position of a FtpDataStream. This property is updated as data is read or written to the stream.” Tried to use FileZilla to upload such large file and it worked fine.

Small files can be uploaded (tried with files that are less than 500KB) normally by FtpClient.UploadFile

Logs :

fluent_ftp_log_file.txt

<paste logs here but DO NOT delete the lines above and below this line>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Trox085commented, Aug 13, 2019

I too am encountering this issue while being connected to FileZilla Server, but the error is not limited to just that server. It doesn’t happen all the time, but I have tracked down the top-level reason.

FluentFTP/Client/FtpClient_HighLevelUpload.cs line 1003 shows

							upStream = OpenAppend(remotePath, UploadDataType, true);
							upStream.Position = offset;

OpenAppend (FluentFTP/Client/FtpClient_LowLevel.cs line 1526) in turn calls OpenDataStream (FluentFTP/Client/FtpClient_LowLevel.cs line 810) which in turn calls OpenPassiveDataStream (FluentFTP/Client/FtpClient_LowLevel.cs line 306) or OpenActiveDataStream (FluentFTP/Client/FtpClient_LowLevel.cs line 578). Both OpenPassiveDataStream and OpenActiveDataStream return FtpDataStream instances.

/FluentFTP/Stream/FtpDataStream.cs line 54 shows

public override long Position {
			get => m_position;
			set => throw new InvalidOperationException("You cannot modify the position of a FtpDataStream. This property is updated as data is read or written to the stream.");
		}

This error occurs only when a socket error of 10054 occurring during a resumed upload. (FluentFTP/Client/FtpClient_HighLevelUpload.cs line 994).

1reaction
CHMaagaardcommented, Apr 24, 2018

I have encountered the same problem using a FileZilla server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FTP connection dropped when uploading file in chunks
(You cannot modify the position of a FtpDataStream. This property is updated as data is read or written to the stream.) System.IO.
Read more >
Exception"You cannot modify the position of a ...
InvalidOperationException : You cannot modify the position of a FtpDataStream. This property is updated as data is read or written to the stream....
Read more >
Timed out trying to read data from the socket stream! #122
Append I get a "You cannot modify the position of a FtpDataStream. This property is updated as data is read or written to...
Read more >
Alternative FTP failure? - Developer
While testing I've found that the AlternativeFTP/FluentFTP is failing on the verify portion within the PutAsync method.
Read more >
Single file operations - Rebex SFTP - Rebex.NET
Single-file upload and download. Use PutFile method to upload a single file, and GetFile method to download it. Both methods require a target...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found