View Full Version : URL spaces
Skyluke
05-24-2005, 09:30 AM
Hello all!! I'm a new user of TrueUpdate and i've a question for you:
I have to download multiple files from an FTP site. Some file has spaces in the name (like "hello all.exe") and the FTPWI library automatically convert it into "ftp://myserver/hello%20all.exe". Our web server does not recognize the "%20" in the name, and return an error code. Can i customize the FTPWI library so it don't convert the spaces into "%20"?
Hi Skyluke,
I have been looking into this and it appears as though encoding spaces in an FTP URL using %20 is an error, this bug will be fixed for the next release of TrueUpdate 2.0.
In the mean time you can get around this problem by uploading the file to your FTP server without a space, and then using FTPWI to download the file to your users hard drive with a space. For example:
FTPWI.Download("ftp://myserver/helloall.exe", "C:\\downloads\\hello all.exe", "user", "password");
Skyluke
05-26-2005, 09:05 AM
Hi Skyluke,
I have been looking into this and it appears as though encoding spaces in an FTP URL using %20 is an error, this bug will be fixed for the next release of TrueUpdate 2.0.
In the mean time you can get around this problem by uploading the file to your FTP server without a space, and then using FTPWI to download the file to your users hard drive with a space. For example:
FTPWI.Download("ftp://myserver/helloall.exe", "C:\\downloads\\hello all.exe", "user", "password");
Many thanks for the suggestion!! I've also a second question for you :PP My updated files are in the same FTP site of the TrueUpdate Server script. We have 2 FTP server, actually. Is it possible to know inside of the server script, from wich server i've downloaded the script? For example:
Server1 = 192.168.1.1 (our LAN server ;)
Server2 = 81.208.xxx.xxx
Obviously our customers can't connect to 192.168.1.1 ;) so I need something that inform the server script that i'm connecting to 81.208.xxx.xxx !!
Thanks again for your help!!
Hi Skyluke,
Yes it is possible to know which server script you have downloaded. If you have used the project wizard to create your project then you will be able to check the value of: screen_globals.CurrentServerIndex right after the line:
if(Screen.Show("Connect to Server") == SR_SUCCESS) then
screen_globals.CurrentServerIndex will be a numeric index into the table of TrueUpdate servers returned by TrueUpdate.GetUpdateServerList(). Which is a numerically indexed table containing the Name/IDs of the TrueUpdate Servers published to the client.
So if you have Server1 and Server2 you would be able to tell which server file was being used by using the following code:
-- Download and run the server script
if(Screen.Show("Connect to Server") == SR_SUCCESS) then
-- Get the list of TrueUpdate Server locations
local tableTrueUpdateServers = TrueUpdate.GetUpdateServerList();
if(tableTrueUpdateServers) then
strServerName = tableTrueUpdateServers[screen_globals.CurrentServerIndex];
if (strServerName=="Server1") then
--Server 1
elseif (strServerName=="Server2") then
--server 2
end
end
TrueUpdate.RunScript("Server Script");
end
Alternatively you can also edit your Download Server Screen directly to keep track of the index and name of the server file used.
Skyluke
05-27-2005, 08:46 AM
Many many thanks! I did it in a similiar way: I've added 2 scripts called "Location1" and "Location2", each configures the FTP variables to connect with the correct server, and i used the CurrentServerIndex to launch the appropriate script!
Thanks 4all!!
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.