Home   Archive   Permalink

ftp upload in shared webhosting account

Hi! I am using nick's tutorial to learn REBOL. There is this blogger exercise that I am trying to replicate. I should be able to write a file by using:
write ftp://user:psswrd@site.com file
But when I try I get
Access Error: Network timeout.
Now, this is a shared web hosting and the site name in the ftp instruction is not the primary account, that is, it does not point to the root folder but to another one that was designated. I asked at the web hosting place but the said that they couldn't help me with REBOL (they recommended I used another ftp client) but pointed out that theirs is a passive ftp.
I did try with Filezilla and was able to reach the folder and read and write to it.
I tried using the name of the primary account but I got TCP Error 530: there is no such folder or file.
I am totally lost here. What can be done?

posted by:   Damian       31-May-2013/18:03:15-7:00

Oh!, I discovered that the instruction:
write ftp://user:psswrd@site.com/test.txt content
actually reaches the correct folder and creates the file "test.txt" However a timeout error happens and the content is not written (empty file and, yes, content did have content).
Is this issue related to permissions? I hope that this new info helps if figuring what's going on. Thanks again.

posted by:   Damian       31-May-2013/18:27:43-7:00

To recap, I am unable to reach a sub-folder in a shared web-hosting account using ftp. As I said, the root folder can be reached by one URL (say www.site1.com). There is another URL (say www.site2.com) that points to a sub-folder in it. When I use:
print read ftp://user:psswrd@site2.com/file.txt
or even
print read ftp://user:psswrd@www.site2.com/file.txt
I get:
Access Error: Network Timeout
Where: confirm
Near: print read ftp://user:psswrd@site2.com/file.txt
However, if I use:
print read http://www.site2.com/file.txt
I am able to read the file with no problem. I can also access it using another ftp client.
Consequently, the http protocol works while the ftp protocol times out. When writing, the ftp protocol times out as well, it does create the file but it can not add any content, all the while the folder has writing permissions.
Why would this be? How can I correct it?
Any help is deeply appreciated.

posted by:   Damian       5-Jun-2013/1:42:20-7:00

Hi Damian,
If you're using an account which requires symbols in the username, you *won't be able to log in using the following syntax:
write ftp://user@site.com:pass@site.com/public_html/test.txt "test"
Try this syntax instead:
write [
     scheme: 'FTP
     host: "site.com"
     port-id: 21
     target: "/test.txt"
     user: "user@site.com"
     pass: "pass"
     user-data: "some text"
] "test"

posted by:   Nick       5-Jun-2013/19:37:37-7:00

I'm currently floundering in the same area, being quite new to REBOL (although have been programming professionally for almost 40 years).
I've written a program to upload all of a hierarchy that has changed since a given date/time to a remote ftp site. The password for the specific site I need to update includes a specal character (@, in fact) hence the usual URL trick fails.
Your example works beautifully for a read and I can even parameterise the block by setting target to another word (variable).
But, I can't get it to create a new directory at the remote end using make-dir or check for existence using exists?
Both give me an error
"expected target argument of type: file url"
I have hunted through the documentation on rebol.com but no example ever seems to go beyond reading/writing the remote end and they all seem to build everything into the block first anyway.
If anyone can shed any light on this I'd be very grateful.
FWIW I'm enjoying REBOL very much.

posted by:   Deryk       12-Jun-2013/14:33:19-7:00

Nick, thanks for your script. How do you come with these things? I hope that one day you could explain why and how this works. I did try it, even as my ftp user name did not contain any special characters and the only dubious character was a "!" in the password. Unfortunately, an "Error tcp 530 Authentication Failed" occurred (and I did check for name and psswrd spelling and other potential errors several times).
I have to say that after several days of trying unsuccessfully with various combinations of ftp users, target folders and other variables, the idea came that maybe something with the configuration of the hosting server is creating this problem. I then tried with another web hosting service I had access to and the simple:
write ftp://user:psswrd@site.com/test.txt data
worked with no problem. So did reading and so did the htpp:// protocol.
I am sorry to mention names but I am just describing facts here: I have been unable to use the write and ftp:// commands/functions with a Godaddy.com account while I had no problem using them with a Globat.com account. (They both use linux, by the way).
If somebody is able to write to a folder using this web hosting service then I would be very grateful if you could share with this forum how you did it. Your success will be a great learning tool for me.

posted by:   Damian       14-Jun-2013/0:33:52-7:00