rejetto forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DanielZ

Pages: 1
1
HFS ~ HTTP File Server / Re: About upload a file to HFS by a Delphi Client
« on: September 07, 2007, 05:16:25 AM »
thanks a lot!
waitting for next version.
and i tried the #130 it's work well. :)

2
HFS ~ HTTP File Server / Re: About upload a file to HFS by a Delphi Client
« on: September 02, 2007, 10:36:43 AM »
hi, there is the test.

3
HFS ~ HTTP File Server / Re: About upload a file to HFS by a Delphi Client
« on: September 01, 2007, 02:02:04 PM »
i tried it used the latest beta version 128#.
but there is a new problem.
the connection cannot be auto disconnected when the transfer finished.
It will be disconnected until the time out.
The file can be uploaded to server successfully but the size is wrong. Destination file size more than source file about 2-3bit.

4
yes, I am sure
and the test folder is a real folder.
and everyone can upload file to the test folder, i already test used web, it's ok.

5
thank you again!
and i follow you to used a IdHTTP send a file to server.

var
    res   :   String;
    mps   :   TIdMultiPartFormDataStream;
begin
    try
        mps   :=   TIdMultiPartFormDataStream.Create;
        mps.AddFile('File1','D:\222.txt','');
        res:=idhttp1.Post('http://192.168.1.100/test/~upload', mps);
    finally
        mps.Free;
    end;

the HFS is already reciving that file, but there is an error :
  Upload failed, Folder not found: 222.txt
how to fix that, thanks!

6
hi, rejetto, thanks for your reply. i used WinINet.
this is my code, but dosen't work, Plz help me again, thank you.

  ALocalFile:= 'D:\upload\111.txt';
  ARemoteServer:= '127.0.0.1';
  ARemoteFile:= '/101_111.txt';

  HttpNet := InternetOpen(PChar(ARemoteServer), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  HttpConnect := InternetConnect(HttpNet, PChar(ARemoteServer), 0, nil, nil, INTERNET_SERVICE_HTTP, 0, 0);
  HttpRequest := HttpOpenRequest(HttpConnect, 'PUT', PChar(ARemoteFile), nil, nil, nil, 0, 0);

  hFile := CreateFile(PChar(ALocalFile), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
  FillChar(BufferIn, SizeOf(BufferIn), 0);
  BufferIn.dwStructSize := SizeOf(BufferIn);
  BufferIn.dwBufferLength := cBuffsize;
  BufferIn.dwBufferTotal := GetFileSize(hFile, nil);
  HttpSendRequestEx(HttpRequest, @BufferIn, nil, HSR_INITIATE, 0);

  ReadInF := 0;
  repeat
    SetLength(pBuffer, cBuffsize);
    ReadFile(hFile, Pointer(pBuffer)^, cBuffsize, Count, nil);
    ReadInF := ReadInF + Count;
    InternetWriteFile(httpRequest, Pointer(pBuffer), Count, oBytesWritten);
  until ReadInF = BufferIn.dwBufferTotal;

  HttpEndRequest(HttpRequest, nil, 0, 0);
  InternetCloseHandle(HttpRequest);
  InternetCloseHandle(HttpConnect); 
  InternetCloseHandle(HttpNet);       


Pages: 1