데이타를 대입하는 부분에서 문제가 안 풀리네요
생각처럼 잘 안되네요
부탁합니다.
그럼 이만...
var
crlf, URL, Boundary, UploadFile, S_Temp, E_Temp : string;
Source : TFilestream;
Send_Stream : TMemoryStream;
Response : TStringStream;
begin
crlf := Chr(13) + Chr(10);
URL := 'http://192.168.1.109/RFC_1867/filePost3.asp';
Boundary := '-----------------------------7d322130300642';
UploadFile := 'D:testtest.jpg';
Header := 'Content-Type: multipart/form-data; boundary='+Boundary+crlf+';';
S_Temp := '--' + Boundary;
S_Temp := S_Temp + crlf;
S_Temp := S_Temp + 'Content-Disposition: form-data; name="test"; filename=';
S_Temp := S_Temp + '"' + UploadFile + '"' + crlf;
S_Temp := S_Temp + 'Content-Type: application/upload' + crlf;
S_Temp := S_Temp + crlf;
E_Temp := crlf;
E_Temp := E_Temp + '--' + Boundary;
E_Temp := E_Temp + crlf;
E_Temp := E_Temp + 'Content-Disposition: form-data; name="filename"' + crlf;
E_Temp := E_Temp + crlf;
E_Temp := E_Temp + 'original';
E_Temp := E_Temp + crlf;
E_Temp := E_Temp + '--' + Boundary + crlf;
E_Temp := E_Temp + 'Content-Disposition: form-data; name="userSpecifiedName"' + crlf;
E_Temp := E_Temp + crlf;
E_Temp := E_Temp + '';
E_Temp := E_Temp + crlf;
E_Temp := E_Temp + '--' + Boundary + '--' + crlf;
Response := TStringStream.Create('');
Source := TFilestream.Create(UploadFile, fmOpenRead);
Send_Stream := TMemoryStream.Create;
// 이부분이 문제 인데요 제가 맞게 작업을 한건지 잘 몰라서요
Send_Stream.WriteBuffer(S_Temp, Sizeof(S_Temp));
Send_Stream.Seek(soFromBeginning, Sizeof(S_Temp));
Send_Stream.CopyFrom(Source, Sizeof(Source));
Send_Stream.Seek(soFromBeginning, Sizeof(S_Temp)+Sizeof(Source));
// 이부분에서는 스트링을 스트림으로 바꿔야 하는데 ...
//Send_Stream.Position := Sizeof(S_Temp)+Sizeof(Source);
//Send_Stream.CopyFrom(E_Temp, Sizeof(E_Temp));
HTTP.HostHeader := Header;
HTTP.Post(URL,Send_Stream,Response);
Source.Free;
Send_Stream.Free;
Response.Free;
end;