Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 02-02-2010
Member
 
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!!!!
Reply With Quote
  #2  
Old 02-02-2010
Member
 
Join Date: Apr 2008
Posts: 2,001
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
Reply With Quote
  #3  
Old 02-02-2010
Member
 
Join Date: May 2008
Posts: 2,293
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);
?>
Reply With Quote
  #4  
Old 02-02-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
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);
?>
Reply With Quote
  #5  
Old 02-02-2010
Member
 
Join Date: Feb 2008
Posts: 1,848
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT +5.5. The time now is 12:48 PM.