FTP file upload with non-ascii characters in filename

Simon Knight smk at anvic.net
Tue Feb 28 04:59:01 EST 2017


First I am not sure why your code replaces spaces with underscores in tFile.

Next I have an application that displays lists of filenames in a folder.  The user clicks on a filename and it is displayed in a browser object on the card.  In order to get this to work I had to convert the displayed and selected file name to one that the OS actually uses at a lower level by using these lines of code:

put GetSourcefolder() & "/" & tFilename into tMyFilePath

replace " " with "%20" in tMyFilePath

replace "|" with "%7C" in tMyFilePath

I make no claims that the problem is restricted to these two characters but this might be a starting point.  Also different OS’s have different rules on the characters used in file names, so you need to account for the OS the server is running and google for character substitutions used in file names.


> On 28 Feb 2017, at 08:23, Matthias Rebbe via use-livecode <use-livecode at lists.runrev.com> wrote:
> Hi,
> i need to upload files with non-ascii characters in the filename and this has to work on Win and Mac OS X.
> My script works fine when uploading files with ascii filenames, but as soon as i select a file with non-ascii characters in its filename i get an error
> What do i have to do with the filenames/filepath (target and source) before doing the upload?
> My script looks like this:
> answer tFile "select file..."
> if it is empty then exit to top
> put it into tFilePath
> replace backslash with slash in tFilePath
> set the itemdelimiter to slash
> put item -1 of tFilePath into tFile
> replace " " with "_" in tFile
> put "ftp://username:password@ftpserver.com/ <ftp://username:password@ftpserver.com/>"& tFile into tURL
> liburlftpupload tFilePath,tURL	
> I´ve tried to urlencode tDatei.
> I am pretty sure there is something more.
> Regards,
> Matthias 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list