LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
I wish to upload a specific file under the application root folder (e.g. data/myfile.txt) to my hosting account. Please advise how to get the path of the local file.
## This must be wrong. Please help to correct it
put ("data/myfile.txt") into tFilePath
## Get the server path
put fld "server_path" of card "upload" of stack "main" into tServerPath
## Upload to server
libURLFTPUploadFile tFilePath, tServerPath
All relative local paths are derived from the defaultFolder global property - not from the location of the current stack or anything like that; if you want that, you'll have to assemble it on the basis of the effective fileName property of your stack.
on mouseUp
## Get the local file path
put the effective filename of this stack into tFilePath
set the itemDelimiter to slash
put "data/myfile.text" into the last item of tFilePath
## Get the server path
put fld "server_path" of card "upload" of stack "main" into tServerPath
## Upload to server
libURLFTPUploadFile tFilePath, tServerPath
end mouseUp