Re: Sending a File Over HTTP

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...

I have a very old one, written for Euphoria 2.3, but it should still work with 4.0

Jim, I can't get that to receive my http_post() call. I wonder if I'm doing this right. Here's my code:

public function transfer(sequence fPath) 
sequence result = "FAIL" 
object filetxt 
 
	filetxt = read_file( fPath ) 
	if not atom(filetxt) then 
        sequence data, fname 
 
        fname = filename( fPath ) 
        data = { 
            { "name", fname }, 
            { "company", url:encode(COMPANY_NAME) }, 
            { "transfer", "true" }, 
            { "data", filetxt, fname, "text/plain", ENCODE_BASE64 } 
        } 
     
         result = http_post( "http://my.ip.address/files/transfer.esp", { MULTIPART_FORM_DATA, data } ) 
	end if 
 
    if not equal(result[2],"SUCCESS!") then 
        ERR_MESSAGE = result[2] 
    else 
        ERR_MESSAGE = "" 
    end if 
	return equal(result[2],"SUCCESS!") 
end function 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu