Page 2 of 2

FTP Upload

Posted: Wed Sep 17, 2008 4:14 pm
by mark
Use <urlcp user> and <urlcp pass> instead of username:password@ notation.

FTP Upload

Posted: Wed Sep 17, 2008 4:23 pm
by aitchon
I'm finding the submit still isn't working - something about returning an error code 550 path not found. I'm trying an alternate way by calling an ftp script called sendftp:

<exec "/usr/bin/ftp <sendftp"></exec>

I get this error "No such file or directory in the function doexec".

FTP Upload

Posted: Wed Sep 17, 2008 5:03 pm
by mark
The path used for ftp upload is absolute, instead of user relative as in some clients. So you need to provide the full path to the directory where you want the file placed. Your url should also specify the filename.

<submit url="ftp://someip/path/to/home/test.txt" fromfile="test.txt">

You shouldn't need to resort to exec, but in general you should note that exec doesn't do "sh -c" so shell constructs like redirection have no meaning. The equivalent of what you said above would be
<exec /usr/bin/ftp><spew sendftp></exec>
but would be better as
<exec /usr/bin/ftp>set host ...
user ...
etc
</exec>

FTP Upload

Posted: Thu Sep 27, 2012 4:53 pm
by aitchon
I've been able to use submit successfully when sending files from a Linux box to a Windows box, but I get a 553 'Document access forbidden' error when sending from a Linux box to another Linux box. I'm sure it has to do with permisssions, but when I try command line FTP to send the file, it works fine. Here's my code:

<$destserverip="192.168.1.1">
<$ftpdestpath="/flags">
<sum "%s" "ftp://" $destserverip $ftpdestpath "/" $newfname>
<$dest=$ret>
<$username="user1">
<$password="password">
<urlcp user $username>
<urlcp pass $password>
<submit url=$dest method=put fromfile=$file>

FTP Upload

Posted: Thu Sep 27, 2012 5:49 pm
by mark
That "works for me" for linux to linux as they say.
Can you access the logs on the ftp server? It may have logged something more informative.

Are you sure you uploaded to the same directory when testing from the command line?

FTP Upload

Posted: Thu Sep 27, 2012 5:58 pm
by Kai
What version of Texis are you using? Also, try setting <urlcp verbose 255> before the <submit>, to see exactly what FTP commands are being sent (this will show passwords, be careful). That should show what FTP command is causing the 553 error. Turn on verbosity in your command-line client as well, if possible, to compare with what it sends.

FTP Upload

Posted: Fri Sep 28, 2012 5:30 pm
by aitchon
<!-- 226 testready:56: >> PASV -->
<!-- 225 testready:56: << 227 Entering Passive Mode (192,168,12,1,54,64) -->
<!-- 226 testready:56: >> STOR /ready1921681223.txt -->
<!-- 225 testready:56: << 553 Could not create file. -->
<!-- 000 testready:56: Document access forbidden: ftp://192.168.12.1/testfile.txt returned code 553 (Could not create file.) while sending command in the function htftp_afterrespline -->

It looks like it's failing on the STOR command. I'm just trying to send the file to the root of the FTP path.

FTP Upload

Posted: Fri Sep 28, 2012 5:51 pm
by Kai
What version of Texis is this? You might need Texis version 6, which has <urlcp ftprelativepaths> (which defaults to `on' in v6). Since your site requires a login, I presume that account is not chroot'd as most anonymous FTP sites are. Thus `STOR /ready...' is probably really attempting to write to the root dir on the target (which fails), not in the user's login dir where it (presumably) has perms.

<urlcp ftprelativepaths on> would prefix the login dir first, to correct this. The alternative in Texis version 5 and earlier is to prefix the user's home dir to the URL path, e.g. if the remote home dir for `user1' is /home/user1 and the URL was originally ftp://host/path/you/want.txt, you'd use instead ftp://host/home/user1/path/you/want.txt. But of course then you'd need to know the user's home dir (hence the setting in v6+).