Note that there are some explanatory texts on larger screens.

plurals
  1. POCan you send a post to a website back to back with TIdHTTP?
    primarykey
    data
    text
    <p>I've got a program that acts as an interface between a web server and a user which allows the user to upload files to the web server. When the user clicks "Upload" it takes the information from a list view and sends it to the website, the first http.Post is for the actual file and the second is for the meta-data I am storing about it.</p> <p>When I comment out the first Post statement it works fine and actually posts the data, but it doesn't seem to get any of the params for the second one when they're both in there. It also works when I run the script in a web browser with the values in Param.</p> <p>UFile is a record containing the file meta-data.</p> <pre><code> IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create; http := TIdHTTP.Create(nil); http.IOHandler := IOHandler; Param := TStringList.Create; DataParams := TIdMultiPartFormDataStream.Create; Stream := TStringStream.Create(''); DebugStream := TStringStream.Create(''); Param.Add('serial='+UFile.Serial); Param.Add('filename='+UFile.Name); Param.Add('filepath='+'\'+UFile.Serial+'\'+IntToStr(UFile.PatchID)); Param.Add('patchid='+IntToStr(UFile.PatchID)); Param.Add('patchnotes='+UFile.PatchNotes); Param.Add('earliestversion='+UFile.EarliestVersion); Param.Add('latestversion='+UFile.LatestVersion); Param.Add('date='+DateToStr(UFile.Date)); Param.Add('execaftersend='+BoolToStr(UFile.ExecAfterSend)); DataParams.AddFile('file', UFile.FilePath, 'application/octet-stream'); try http.Post('http://example.com/postFile.php', DataParams, Stream); ShowMessage(Stream.DataString); http.Post('http://example.com/uploadFiles.php', Param, DebugStream); ShowMessage(DebugStream.DataString); for J := 0 to Pred(Param.Count) do DebugStrings := DebugStrings + '&amp;' + Param.Strings[J]; ShowMessage(DebugStrings); except on E: EIdHTTPProtocolException do begin ShowMessage('Error code:' + IntToStr(E.ErrorCode)); end end; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload