Есть ли у вас конкретный примерчик реализации передачи файла от клиента на сервер? 
Добавлено через 12 минут и 51 секунду И ещё вопрос: вот пример исходника который отсылает файл с сервера на клиента...| Код | procedure TForm1.ClientRead(Sender: TObject; Socket: TCustomWinSocket); var NewSize, FileName, PathCopy : string ; comand : string ; begin comand := socket.ReceiveText ; if rem then begin try fs.Write(comand[1],length(comand)); if (fs.Size = Filesize) or (length(comand) = 0) then begin fs.Free ; rem := false ; client.Socket.SendText('GETOK'); client.Close ; exit; end; except end; end;
if copy(comand,1, 5) = 'size:' then begin NewSize := copy(comand, 6, pos(#0, comand)-6); FileSize := strToint(NewSize); delete(comand, 1, pos(#0, comand));
if copy(comand, 1, 9) = 'filename:' then begin FileName := copy(comand, 10, pos(#0, comand)-10); delete(comand, 1, pos(#0, comand)); end;
if copy(comand, 1, 5) = 'path:' then begin PathCopy := copy(comand, 6, pos(#0, comand)- 6); delete(comand, 1, pos(#0, comand)); if PathCopy = '' then PathCopy := 'C:\'; if PathCopy[length(PathCopy)] <> '\' then PathCopy := PathCopy+'\'; if not DirectoryExists(PathCopy) then begin try mkDir(PathCopy); except PathCopy := 'C:\'; end; end;
rem := TRUE ; fs := TfileStream.Create(pathCopy+Filename, fmCreate); fs.Write(comand[1], length(comand)); end; end; end;
|
Здесь сервер передает файловый поток клиенту, но если файл менее 8 кило, то клиент получат файл, но не уничтожается файловый поток| Код | if (fs.Size = Filesize) or (length(comand) = 0) then begin fs.Free ; rem := false ; client.Socket.SendText('GETOK'); client.Close ; exit; end;
|
. Что посоветуете? |