Subj : Help
To   : All
From : Wayne Steele
Date : Sun Oct 09 2005 07:44 am

Hi All,

I'm trying too workout why elebbs ftp server fails to send longfilenames with
spaces but will send longfilenames without spaces correctly... When you try and
send lfn with spaces it sends 0 bytes and resends :( comes back with a 450
error...

Below is the code for sending the file was hoping to have the file put into "
" how does one do this?

procedure cmdRetr(const CurSlot: Longint; var ParamString: String);
var ResStr : String;
WildCardStr : String;
ListGroup : Longint;
ListArea : Longint;

FilesInf : FilesRecord;

Temp_F : pFileObj;
InvalidDir : Boolean;
DidRead : Longint;
Counter : Longint;
DidSent : Longint;
TmpBuf : Array[0..4095] of Char;
begin
{-- we default to the current group/area listing -------------------------}
ListArea := ftpConnectionRec(Connections[CurSlot].SrvData^).CurArea;
ListGroup := ftpConnectionRec(Connections[CurSlot].SrvData^).CurGroup;

{-- make sure we can retrieve the file etc, then actually send it --------}
with ftpConnectionRec(Connections[Curslot].SrvData^) do
begin
{-- Break it up ------------------------------------------------------}
GetPartsFromDir(ParamString,
WildCardStr,
CurSlot,
InvalidDir,
ListGroup,
ListArea);

{-- Get the file path ------------------------------------------------}
GetFilesRecord(FilesInf, ListArea, true);

{-- if we have access to this group ----------------------------------}
if NOT CheckFileAreaAccess(FilesInf,
TRUE, { download }
FALSE, { groupcheck }
FALSE, { upload check }
FALSE, { list access }
ListGroup,
ftpConnectionRec(
Connections[CurSlot].SrvData^).Exitinfo){ exitinfo } then
WildCardStr := �;

{-- we should add checks wether the file is unavailable, missing, etc-}
{-- to it, but currently we only do that at the listing part ---------}

{-- make sure we have download access --------------------------------}
if WildcardStr <> � then
begin
{-- Now try opening the file -------------------------------------}
New(Temp_F, Init);
Temp_F^.Assign(FilesInf.FilePath + StripIllegal(WildCardStr));
Temp_F^.FileMode := ReadMode + DenyNone;

if Temp_F^.Open(1) then
begin
{-- open data connections ------------------------------------}
if OpenDataConnection(CurSlot, ResStr) then
begin
{-- we have a working dataconnection, use it as we want --}
while (NOT Temp_F^.EOF) AND (DataThread.ConnectionAlive) do
begin
{-- read the required data ---------------------------}
DidRead := Temp_F^.BlkRead(TmpBuf, SizeOf(TmpBuf));

{-- create a small loop to ensure we send everything -}
Counter := 0;

while (Counter < DidRead) AND (DataThread.ConnectionAlive) do
begin
DataThread.SendBuf(TmpBuf[Counter], (DidRead - Counter), DidSent);

if DidSent = DidRead then
Inc(Counter, DidSent)
else DataThread.DoSleep(100);
end; { while }

end; { while }

{-- and eventually close it again ------------------------}
CloseDataConnection(CurSlot, true);
end; { if }
end { file open }
else SendCodeStr(CurSlot, 450);

{-- and close the file -------------------------------------------}
Dispose(Temp_F, Done);
end { if }
else begin
SendCodeStr(CurSlot, 450);
end; { file is not available (security) }
end; { with }
end; { proc. cmdRetr }



Thanking anyone in adavnce...

Lata,
    zomorf
---
* Origin: Come & Visit for a Kick@ss EleBBS & EleWEB BBS (3:633/690)