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!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
alex298
- Posts: 101
- Joined: Mon May 01, 2006 1:17 pm
Post
by alex298 » Fri May 01, 2009 11:31 am
Hello,
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
Thanks and best regards
Alex
Nice to meet all of you.
-
alex298
- Posts: 101
- Joined: Mon May 01, 2006 1:17 pm
Post
by alex298 » Fri May 01, 2009 2:40 pm
Hi,
Really strange.... I re-started the computer and it works.
Thanks and best regards
Alex
Nice to meet all of you.
-
Janschenkel
- VIP Livecode Opensource Backer

- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
-
Contact:
Post
by Janschenkel » Fri May 01, 2009 7:17 pm
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.
Code: Select all
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
HTH,
Jan Schenkel.