When the server already has the same file name and it is incomplete and needs to be appended, the 3rd parameter of UploadFile is set to false and the upload file will have an error, the file size is fine but the first half of the file is set to 0 and the appended content is placed at the end of the file.
After tracing the code, the code in the TScSFTPClient.OpenAndUploadFile function OpenModes := [foWrite, foCreate, foExcl]; needs to be changed to OpenModes := [foWrite, foCreate, foAppend]; to be able to properly Append the file.
Search found 8 matches
- Wed 19 Oct 2022 07:16
- Forum: SecureBridge
- Topic: TScSFTPClient.UploadFile error in uploading a file
- Replies: 0
- Views: 111556
- Wed 03 Aug 2022 09:21
- Forum: SecureBridge
- Topic: TScFTPClient uploads a file of 0 bytes after setting UseCompression to True
- Replies: 1
- Views: 7776
TScFTPClient uploads a file of 0 bytes after setting UseCompression to True
TScFTPClient was uploading files of 0 bytes after setting UseCompression to True.
After reviewing the source code, the problem can be solved by modifying the TScFTPClient.OnWriteData function as follows
procedure TScFTPClient.OnWriteData(Stream: TStream; const Data: TBytes; Count: integer);
begin
// FDataConnection.Write(TValueArr(Buffer), 0, Count);// This is the original code
FDataConnection.Write(TValueArr(Data), 0, Count);
DoProgress(FTotalUploadSize, FTotalUploadSize - (Stream.Size - Stream.Position));
end;
After reviewing the source code, the problem can be solved by modifying the TScFTPClient.OnWriteData function as follows
procedure TScFTPClient.OnWriteData(Stream: TStream; const Data: TBytes; Count: integer);
begin
// FDataConnection.Write(TValueArr(Buffer), 0, Count);// This is the original code
FDataConnection.Write(TValueArr(Data), 0, Count);
DoProgress(FTotalUploadSize, FTotalUploadSize - (Stream.Size - Stream.Position));
end;
- Tue 26 Jan 2010 07:44
- Forum: VirtualDAC
- Topic: Unknown data type FieldDesc.DataType=27
- Replies: 7
- Views: 7140
- Tue 26 Jan 2010 07:38
- Forum: VirtualDAC
- Topic: Unknown data type FieldDesc.DataType=27
- Replies: 7
- Views: 7140
- Tue 26 Jan 2010 05:25
- Forum: VirtualDAC
- Topic: Unknown data type FieldDesc.DataType=27
- Replies: 7
- Views: 7140
- Fri 15 Jan 2010 02:36
- Forum: VirtualDAC
- Topic: Unknown data type FieldDesc.DataType=27
- Replies: 7
- Views: 7140
- Thu 14 Jan 2010 01:42
- Forum: VirtualDAC
- Topic: Unknown data type FieldDesc.DataType=27
- Replies: 7
- Views: 7140
- Mon 11 Jan 2010 03:45
- Forum: VirtualDAC
- Topic: Unknown data type FieldDesc.DataType=27
- Replies: 7
- Views: 7140
Unknown data type FieldDesc.DataType=27
/*
--SQL 2000 or SQL 2005 or SQL 2008
Create table test
(
column1 numeric(14,4)
)
insert into test values(14.55)
*/
TMemoryStream *ms=new TMemoryStream();
ADOQuery1->SQL->Add("select * from test");
ADOQuery1->Open();
VirtualTable1->Assign(ADOQuery1);
VirtualTable1->SaveToStream(ms); <---Unknown data type FieldDesc.DataType=27
//I Use VirtualTable 6.90 for RAD Studio 2010
--SQL 2000 or SQL 2005 or SQL 2008
Create table test
(
column1 numeric(14,4)
)
insert into test values(14.55)
*/
TMemoryStream *ms=new TMemoryStream();
ADOQuery1->SQL->Add("select * from test");
ADOQuery1->Open();
VirtualTable1->Assign(ADOQuery1);
VirtualTable1->SaveToStream(ms); <---Unknown data type FieldDesc.DataType=27
//I Use VirtualTable 6.90 for RAD Studio 2010