Results 1 to 5 of 5

Thread: Use of the ftp_alloc() : PHP

  1. #1
    Join Date
    Dec 2009
    Posts
    26

    Use of the ftp_alloc() : PHP

    Hi, How are you all. I have the knowledge of the HTML language. But I do not know anything about the PHP language. I have to learn that how could allocate the memory for files in the PHP. So, I would like to know about the ftp_alloc() function of the PHP. I also would like to know how can I implement the ftp_alloc() function in the coding how the ftp_alloc() function cab allocate the memory for file that being transferring. Therefore, If anyone knows about the ftp_alloc() function then reply me!!!!

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Use of the ftp_alloc() : PHP

    The space can be allocate for a file that can to be uploaded on to the FTP server by the ftp_alloc() function. The ftp_alloc() function can returns the FALSE on failure or TRUE on success. The following can be the syntax of the ftp_alloc() function :
    ftp_alloc(ftp_connection,size,return)
    The ftp_connection describes the FTP connection to use. The size describes the number of bytes to allocate and the return can be Optional that describes a variable to store the server response in

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    program : Use of the ftp_alloc()

    The following sample program describes you the ftp_alloc() function :
    Code:
    <?php
    $fil = "mfil.txt";
    $con = ftp_connect("ftp.tstftp.com") or die("Can not connect");
    ftp_login($con,"admn","ert678");
    if (ftp_alloc($con, filsz($fil), $respns))
      {
      echo "Space allocated on server.";
      }
    else
      {
      echo "Unable to allocate space. " . $respns;
      }
    ftp_close($con);
    ?>

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Use of the ftp_alloc() : PHP

    There can be one more example on the ftp_alloc() function :
    Code:
    <?php
    $fil = "/home/user/mfile";
    $cnid = ftp_connect('ftp.exmpl.com');
    $lgnrslt = ftp_login($cnid, 'anonymous', 'user@exmpl.com');
    if (ftp_alloc($cnid, filesize($fil), $rslt)) {
      echo "Space successfully allocated on server.  Sending $fil.\n";
      ftp_put($cnid, '/incomming/mfil', $fil, FTP_BINARY);
    } else {
      echo "Unable to allocate space on server.  Server said: $rslt\n";
    }
    ftp_close($cnid);
    ?>

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Use of the ftp_alloc()

    I suggest you to notice that the many of the FTP servers can not support ftp_alloc() function command. So, Those FTP servers can return a success code i.e. TRUE to indicate that pre-allocation can not be necessary or a failure code i.e. FALSE indicating the command can not supported and the client should continue as though the operation were successful. Because of that reason, it can not be better to reserve this ftp_alloc() function for servers which can explicitly required preallocation.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,939,376.61102 seconds with 15 queries