Livecode Wiki

This function lets you add parts to a multipart form one at a time. It also lets you optionally specify the mime type and transfer encoding for each part. This can be useful where the mime type or transfer encoding has to be specified.


libURLMultipartFormAddPart(form data,part name,value[,MIME type,encoding])


put empty into tForm
put "dave" into tName
put "hello" into tMessage
if libURLMultipartFormData (tForm, "name", tName, "message", tMessage)  is not empty then
  ##handle error and exit
end if
set the httpHeaders to line 1 of tForm
delete line 1 of tForm
put "<file>" & "C:/myfile.gif" into tFile
put "image/gif" into tType
put "binary" into tEnc
if libURLMultipartFormAddPart(tForm,"file", tFile, tType, tEnc) is empty then
  ##handle error and exit
 post  tForm to url 
 set the httpHeaders to empty
end if

This function is mainly used if you have called the libURLMultipartFormData with no arguments except the form data. This will return an "empty" form which can be added to using this function.

See: Internet library

See Also: post Command, libURLMultipartFormData Function, libURLFormData Function