FTP Upload

User avatar
mark
Site Admin
Posts: 5514
Joined: Tue Apr 25, 2000 6:56 pm

FTP Upload

Post by mark »

Use <urlcp user> and <urlcp pass> instead of username:password@ notation.
aitchon
Posts: 118
Joined: Mon Jan 22, 2007 10:30 am

FTP Upload

Post 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".
User avatar
mark
Site Admin
Posts: 5514
Joined: Tue Apr 25, 2000 6:56 pm

FTP Upload

Post 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>
aitchon
Posts: 118
Joined: Mon Jan 22, 2007 10:30 am

FTP Upload

Post 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>
User avatar
mark
Site Admin
Posts: 5514
Joined: Tue Apr 25, 2000 6:56 pm

FTP Upload

Post 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?
User avatar
Kai
Site Admin
Posts: 1271
Joined: Tue Apr 25, 2000 1:27 pm

FTP Upload

Post 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.
aitchon
Posts: 118
Joined: Mon Jan 22, 2007 10:30 am

FTP Upload

Post 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.
User avatar
Kai
Site Admin
Posts: 1271
Joined: Tue Apr 25, 2000 1:27 pm

FTP Upload

Post 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+).
Post Reply