Upload an Download Problem^^

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

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Upload an Download Problem^^

Post by bangkok » Sun Jan 10, 2010 1:02 pm

Very strange indeed.

I see a last source of problem : the exact filepath of the file located on the FTP server. You're talking about "test.zip".

If your FTP server is XX.XX.XX.XX are you sure that "test.zip" can be found in XX.XX.XX.XX/test.zip ?

And another thing that could help you : change the downloadComplete handler, by adding the status (parameters back). You'll see if the error is coming from the FTP server.

on downloadComplete pURL, pStatus
answer pURL
answer pStatus
hide scrollbar "progressbar"
end downloadComplete

MasterchiefJB
Posts: 76
Joined: Sat Nov 07, 2009 7:43 pm

Re: Upload an Download Problem^^

Post by MasterchiefJB » Sat Jan 16, 2010 12:00 pm

Well I contacted Klaus and he found out that my Downloadlink is correct but the FTP Server adds an Underscore to the Downloadlink and gives error 550 Can't open /lego/newmod2.zip_: No such file or directory back.

Correct Link I send: ftp://xxx:xxx@ftp.xxx.org/lego/newmod2.zip
Link I get back ftp://xxx:xxx@ftp.xxx.org/lego/newmod2.zip_


If anyone has an Idea why the server adds an underscore after my Downloadlink please tell me. I also took an indeep look into my scripts and nowere is an Underscore contained, so my scripts shouldn´t be the error.

Any help will be appreciated,
Masterchief

MasterchiefJB
Posts: 76
Joined: Sat Nov 07, 2009 7:43 pm

Re: Upload an Download Problem^^

Post by MasterchiefJB » Mon Jan 18, 2010 8:03 pm

So, today I got an answer to my questions and this is the mail:
"Dear Masterchief,

However, if the server is adding an underscore, then there is nothing Rev can do.
The issue is with the server and you will need to contact their admin to see why
it happens. Your script can remove the underscore though. Before you try to
download, check to see if there is an underscore before the final dot (".") and if
so, just remove it."

Thanks to the support I got a hint and asked the Hoster but they can´t do anything about it (for security reasons) and so I would like to know how I could script the method the support describes here:
"Your script can remove the underscore though. Before you try to
download, check to see if there is an underscore before the final dot (".") and if
so, just remove it"
Well I don´t have a clue to that and if anybody could give me a hint, it will be appreciated.

Best Regards,
Masterchief

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Upload an Download Problem^^

Post by Janschenkel » Tue Jan 19, 2010 12:20 pm

Stripping off the underscore can be done using this function:

Code: Select all

function RemoveUnderscoreBeforeExtension pPath
   local tPath, tFile
   --
   put pPath into tPath
   set the itemDelimiter to slash
   put the last item of tPath into tFile
   set the itemDelimiter to "."
   if the number of items in tFile > 1 and the last char of item -2 of tFile is "_" then
      put empty into the last char of item -2 of tFile
   end if
   set the itemDelimiter to slash
   put tFile into the last item of tPath
   return tPath
end RemoveUnderscoreBeforeExtension
HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Upload an Download Problem^^

Post by Klaus » Tue Jan 19, 2010 12:24 pm

Hi Jan and all,

that is just too easy!

This is the real problem, and this is nothing we can change so far!!!!!
...but the FTP Server adds an Underscore to the Downloadlink and gives error
550 Can't open /lego/newmod2.zip_: No such file or directory !! :!: :!: :!:
back.

Correct Link I send: ftp://xxx:xxx@ftp.xxx.org/lego/newmod2.zip
Link I get back ftp://xxx:xxx@ftp.xxx.org/lego/newmod2.zip_
Best

Klaus

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Upload an Download Problem^^

Post by Janschenkel » Tue Jan 19, 2010 12:31 pm

Ah, heh, I should have read the complete history, not just the last entry where MasterChief copied the reply from support and was asking how to strip off an underscore before the extension. Well, it's all up to the server admin then...

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

MasterchiefJB
Posts: 76
Joined: Sat Nov 07, 2009 7:43 pm

Re: Upload an Download Problem^^

Post by MasterchiefJB » Tue Jan 19, 2010 4:39 pm

Well I didn´t solve the problem but I got it working using http instead ftp. I don´t know why but I had just to change ftp:// into http:// and now it works.
Thanks everyone who helped me;)

The last thing I would like to know is the fact that

Code: Select all

libURLDownloadToFile myFile,newPath,"downloadComplete"
contains the filepath where the new file should be stored but how can I embend the original filename into the filepath?

I would assume to do it with

Code: Select all

 put "C:\myApp" into tpath
put tFilenameToDownload after tpath
libURLDownloadToFile tFilenameToDownload,tpath,"downloadComplete
But I am not sure. (I will give it a try when I got home^^)

Best Regards,
Masterchief

Post Reply