Page 1 of 1

How to get the local file path to upload to hosting account?

Posted: Fri May 01, 2009 11:31 am
by alex298
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

Posted: Fri May 01, 2009 2:40 pm
by alex298
Hi,

Really strange.... I re-started the computer and it works.

Thanks and best regards

Posted: Fri May 01, 2009 7:17 pm
by Janschenkel
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.