libURL and New TsNet Commands/Failures

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Aug 1 14:53:50 EDT 2016


charles at techstrategies.com.au> wrote:

    If you want to avoid loading the data into memory first, the best 
    command for that would be tsNetUploadFileSync.  Let me know if you need 
    any help working out the syntax for that.

I (indy licensed user) did my best to implement this (see my code below)

but got this as an error message:

executing at 8:50:14 AM
Type	external: unlicensed
Object	Upload A File with tsNet
Line	
Hint	tsNet

Stack script:

function setTsNetSettings
    tsNetCreateMissingDirs "true"
   put "false" into aTsNetSettings["use_ssl"] 
   put "false" into aTsNetSettings["no_transfer"]
   put "" into aTsNetSettings["no_reuse"]
   put "false" into aTsNetSettings["save_sent_headers"]
   put fld "UserName" into aTsNetSettings["username"]
   put fld "PassWord" into aTsNetSettings["password"]
   put "" into aTsNetSettings["ssh_host_public_key"]
   put "" into aTsNetSettings["proxy_headers"]

end setTsNetSettings

Button script # test with a single file for starters:

on mouseUp
   # see stack script for the set ups:
   put initializeConnectionDetails() into tStem
   put setTsNetSettings() into tTsSettings
   
   put fld "remoteTarget" after tStem
   answer file "Choose a file to upload"
   put it into tFilePath
   set the itemDel to "/"
   put item -1 of tFilePath into tFilename
   replace space with "_" in tFileName
   
   # for now create an arbitrary location to upload to
   # assume the  tsNetCreateMissingDirs "true"  will
   #  take care of the option to auto mkDir as needed serverside
   
   put (tStem & "testUploads/" & tFilename) into tRemoteLocation

    # from dictionary the form for tsNet upload is:
  
  # tsNetUploadFileSync(pFile, pURL, pHeaders, pOutHeaders, pBytes, [pSettings])
    
   get tsNetUploadFileSync(tFilePath,tRemoteLocation,pOutheaders,pBytes,tTsSettings)
   put it & cr & cr after tOutput
   put the result after tOutput
   put tOutput into fld "downloadedData"
   
end mouseUp

# result

executing at 8:50:14 AM
Type	external: unlicensed
Object	Upload A File with tsNet
Line	
Hint	tsNet










More information about the use-livecode mailing list