# 1 ftp.put

<ftp.put    name='name'    encoding='encoding'/>

#### Exceptions

attribute 'name' required

The name with which the uploaded file will appear has not been specified.

attribute 'name' required

The name with which the uploaded file will appear has not been specified.

requires 1 arguments, recieved [...]

The name of arguments is not 1.

Example

List the content of the home directory, upload an image and list again the file names contained in the directory.

Copy
<xsql-script name='ftp_sample1'>
<body>
<println><ftp.list /></println>
<file name="/tmp/snowfall.jpg" type="absolute" />
</ftp.put>
<println><ftp.nlst /></println>
</ftp>
</body>
</xsql-script>

In the communication of the example, it is ordered to list the content of the default folder that is accessed when logging in, using the function <ftp.list>. The list is visualized by screen with the print label <println>, appearing the following information:

Copy
drwxrwxrwx   2 ftpuser  ftpuser      4096 Feb 20 04:00 clients
-rw-r--r--   1 ftpuser  ftpuser   3321363 Feb  8 09:43 jt400.jar
-rwxr--r--   1 ftpuser  ftpuser        19 Feb 25 11:43 null_test.xml
drwxr-xr-x   3 ftpuser  ftpuser      4096 Mar 17  2004 pub
-rw-r--r--   1 ftpuser  ftpuser    102400 Dec 31 11:03 solaris.tar
-rwxr--r--   1 ftpuser  ftpuser 111083130 Jan 29 17:39 t5.zip
-rw-r--r--   1 ftpuser  ftpuser       386 Feb 25 09:24 text
drwxr-xr-x   2 ftpuser  ftpuser      4096 Feb  4 10:32 tmp

The second operation which is performed in the example, is an upload of the file snowfall.jpg with the function <ftp.put>. This file is renamed to uploaded_image.jpg using the name attribute:

Copy
<ftp.put name='uploaded_image.jpg' /><file.open name='p:\snowfall.jpg' /></ftp.put>

Finally it is obtained again a list but only with the file names of the remote folder <ftp.nlst>. The reuslt would be the following:

Copy
pub
solaris.tar
t5.zip
tmp
text
clients
jt400.jar
null_test.xml
uploaded_image.jpg

Where uploaded_image.jpg is the film which has been transferred (from Application Server to the remote FTP server).