FTP file upload with non-ascii characters in filename

Matthias Rebbe matthias_livecode_150811 at m-r-d.de
Tue Feb 28 07:07:43 EST 2017


Thanks Simon, but this does not fix the problem.
> Am 28.02.2017 um 10:59 schrieb Simon Knight via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>:
> 
> Hi
> 
> First I am not sure why your code replaces spaces with underscores in tFile.
> 
Because i do not like spaces in URLs. I know, that i could replace it with %20, but i prefer “_” instead.

Regards,
Matthias

> 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.
> 
> Skids
> 
> 
>> On 28 Feb 2017, at 08:23, Matthias Rebbe via use-livecode <use-livecode at lists.runrev.com <mailto: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/> <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 <mailto: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 <http://lists.runrev.com/mailman/listinfo/use-livecode>
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com <mailto: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 <http://lists.runrev.com/mailman/listinfo/use-livecode>


Matthias Rebbe
Bramkampsieke 13
32312 Lübbecke
Tel	+49 5741 310000
    	+49 160 5504462
Fax: +49 5741 310002
eMail: matthias at m-r-d.de <mailto:matthias at m-r-d.de>

BR5 Konverter - BR5 -> MP3 <http://matthiasrebbe.eu/portfolio/produkte/brx/>



More information about the use-livecode mailing list