Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ftp_alloc(3) [php man page]

FTP_ALLOC(3)								 1							      FTP_ALLOC(3)

ftp_alloc - Allocates space for a file to be uploaded

SYNOPSIS
bool ftp_alloc (resource $ftp_stream, int $filesize, [string &$result]) DESCRIPTION
Sends an ALLO command to the remote FTP server to allocate space for a file to be uploaded. Note Many FTP servers do not support this command. These servers may return a failure code ( FALSE) indicating the command is not sup- ported or a success code ( TRUE) to indicate that pre-allocation is not necessary and the client should continue as though the oper- ation were successful. Because of this, it may be best to reserve this function for servers which explicitly require preallocation. PARAMETERS
o $ftp_stream - The link identifier of the FTP connection. o $filesize - The number of bytes to allocate. o $result - A textual representation of the servers response will be returned by reference in $result if a variable is provided. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 ftp_alloc(3) example <?php $file = "/home/user/myfile"; // connect to the server $conn_id = ftp_connect('ftp.example.com'); $login_result = ftp_login($conn_id, 'anonymous', 'user@example.com'); if (ftp_alloc($conn_id, filesize($file), $result)) { echo "Space successfully allocated on server. Sending $file. "; ftp_put($conn_id, '/incomming/myfile', $file, FTP_BINARY); } else { echo "Unable to allocate space on server. Server said: $result "; } ftp_close($conn_id); ?> SEE ALSO
ftp_put(3), ftp_fput(3). PHP Documentation Group FTP_ALLOC(3)

Check Out this Related Man Page

FTP_PASV(3)								 1							       FTP_PASV(3)

ftp_pasv - Turns passive mode on or off

SYNOPSIS
bool ftp_pasv (resource $ftp_stream, bool $pasv) DESCRIPTION
ftp_pasv(3) turns on or off passive mode. In passive mode, data connections are initiated by the client, rather than by the server. It may be needed if the client is behind firewall. Please note that ftp_pasv(3) can only be called after a successfull login or otherwise it will fail. PARAMETERS
o $ftp_stream - The link identifier of the FTP connection. o $pasv - If TRUE, the passive mode is turned on, else it's turned off. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 ftp_pasv(3) example <?php $file = 'somefile.txt'; $remote_file = 'readme.txt'; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // turn passive mode on ftp_pasv($conn_id, true); // upload a file if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file "; } else { echo "There was a problem while uploading $file "; } // close the connection ftp_close($conn_id); ?> PHP Documentation Group FTP_PASV(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

filesize from a file which has the list of files.

i have a file myfile. it has the below entries /temp/firstfile /temp/secondfile and many more.. okay, now, i want to addup all the space occupied by this file hmmm, but i met with a problem in getting each file out. i did a silly command like more myfile | grep temp | ls -ltr and it... (3 Replies)
Discussion started by: yls177
3 Replies

2. UNIX for Dummies Questions & Answers

Password recovery

We recently terminated a developer at my place of employment who created scripts on a windows server (that i do not have access to) that invoke FTP sessions on my UnixWare 7.1.1 servers. I need to know the password that is being used. Does anyone know of a good password crack? (8 Replies)
Discussion started by: rm -r *
8 Replies

3. UNIX for Dummies Questions & Answers

UNIX and filesize

Hey guys. What I need to do is this: I need to find files that have a certain filesize (for this case a file size of 0 (zero) ) When I find this file with a filesize of zero I need to echo a statement that tells the user to delete it and not to delete it if the filesize is greater than... (3 Replies)
Discussion started by: ndoggy020
3 Replies

4. Shell Programming and Scripting

getting filesize

Hello, I have a script that should store file size in a variable $filesize. I don't know what is the best way to do it. I tried ls -lt myfile.txt | sed something >$filesize but I don't know how to use sed to get filesize. I know that the owner of the file is root and then we have some... (6 Replies)
Discussion started by: pppswing
6 Replies

5. Shell Programming and Scripting

Filesize not working

I am having problems with finding the filesize with this in my script: filesize=`ls -l | awk '$5=0'` if ; then ls -l | awk '{print $9 " " $5}' if ; then echo "Would you like to delete this file? (y/n)" if yes do this elif no do this fi fi else... (7 Replies)
Discussion started by: akeenabawa
7 Replies

6. Shell Programming and Scripting

How to make sure a file is uploaded in its entirety

Hi, I have a client who uploads files to my FTP server on a regular basis. Instead of checking the server all the time, I wrote a script that e-mail me to let me know that there is a new file and attaches is it in the e-mail (they're all small compressed archives). The potential issue with the... (4 Replies)
Discussion started by: ph0enix
4 Replies

7. Shell Programming and Scripting

Calculating server space

I am Connected With 4 servers I want to check the free space available in each server HOW to do this ? Edit/Delete Message (3 Replies)
Discussion started by: pranabrana
3 Replies

8. Shell Programming and Scripting

Calculating server space

I am Connected With 4 servers I want to check the free space available in each server HOW to do this ? (8 Replies)
Discussion started by: pranabrana
8 Replies

9. Linux

FTP not working under Linux but working under any other OS ??? Very strange

Dear all, I am totally despaired and puzzled. Using Filezilla under Windows under the same network as our Linux servers is working. Using FTP command-line client under any of our Linux debian servers is not working ! I tried with different FTP servers -> same problem ! All commands are... (12 Replies)
Discussion started by: magix_ch
12 Replies

10. UNIX for Dummies Questions & Answers

FTP Getting a Folder

I am a total noob assume i know nothing I have dabbed in it a little in the past but that was so long ago i have forgotten it all. Back story: (short version) Rented a web server from xenon servers. Need it to Grab some files from another server from xenon (minecraft server) (images of the map)... (4 Replies)
Discussion started by: RustyDagger
4 Replies

11. UNIX for Advanced & Expert Users

Space Problem in Unix Server

Hi, I am having space issues in unix server. The free space is getting reduced gradually in my server. I gave the df -g /folder1 command to check the free space and it showed as 0.75 GB. I then deleted some files from the unix server and then checked the size of each dir using the du... (5 Replies)
Discussion started by: mick_000
5 Replies

12. UNIX for Advanced & Expert Users

Unable to use FTP command to connect from one server to another

Hi, I have two unix servers A and B. from A i am trying to use the ftp command to connect to B but I am getting the "ftp: connect: A remote host refused an attempted connect operation." I checked the following things : 1.) Unix Server details for A and B after running the command uname -a... (3 Replies)
Discussion started by: mick_000
3 Replies

13. UNIX and Linux Applications

Brtools Help

im trying to extend table space for SAP server on AIX for all servers extended without problem except one server after adding the Table Space name in the br-tools and click C twice its giving me following error : BR0292I Execution of BRSPACE finished with return code 3 BR0668I Warnings or... (3 Replies)
Discussion started by: vip1982
3 Replies

14. Red Hat

Files copied to FTP server not shown

I had copied 2 files to an FTP server which I deployed on my RHEL 5.8 server. The ownership I kept for the files are for the user, ftp. But, I do not see the files on the FTP location using either accessing through Windows explorer or the browser. The ftp location is ftp://10.101.17.80/incoming.... (7 Replies)
Discussion started by: RHCE
7 Replies

15. Red Hat

Need automation script executing on multiple servers from one server

I have a tar file uploaded in a FTP server and it needs to be deployed in some 300 linux machines in a path like /opt/oracle/scripts and untar the file. it needs to be executed with one shell script by executing on all the the servers. this tar needs to deployed by doing pbrun su - user.... (4 Replies)
Discussion started by: appoo4
4 Replies