post a file

Trevor DeVore lists at mangomultimedia.com
Wed Sep 26 19:42:17 EDT 2007


On Sep 25, 2007, at 11:44 AM, R. Hillen wrote:

> Hello list,
>
> I want to tansfer a local binary file fff.shp to url MyUrl by http- 
> post.
>
> Can you explain, how to post a file?
>
> I think somewhat like  >post file fff.shp to URL MyUrl<
>
> Is that really so simple?

Richard,

Here is some code I use to post files to a server. Maybe this will  
help you out.

## Create form
put the httpheaders into theOrigHeaders	
put libUrlMultipartFormData(theForm, "someVar", someData) into theResult
set the httpheaders to line 1 of theForm
delete line 1 of theForm

## Add file to form
put "<file>" & thePathToTheFileOnDisk into theFilePart
put libUrlMultipartFormAddPart(theForm, "images", theFilePart, "image/ 
jpeg", "binary") into theResult

## POST
post theForm to theURL
put the result into theError
put it into theReturnedValue

set the httpheaders to theOrigHeaders


-- 
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com    -    www.screensteps.com



More information about the use-livecode mailing list