Difference between revisions of "JFTP/create"
From Joomla! Documentation
< API16:JFTP
(New page: ===Description===
Method to create an empty file on the FTP server
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowi...) |
m (removing red link to edit, no existant pages) |
||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 77: | Line 77: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 92: | Line 92: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API16]] |
Revision as of 21:54, 13 May 2013
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Method to create an empty file on the FTP server
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
create($path)
Parameter Name | Default Value | Description |
---|---|---|
$path | $path Path local file to store on the FTP server |
Returns[edit]
boolean True if successful
Defined in[edit]
libraries/joomla/client/ftp.php
Importing[edit]
jimport( 'joomla.client.ftp' );
Source Body[edit]
function create($path) {
// If native FTP support is enabled lets use it...
if (FTP_NATIVE) {
// turn passive mode on
if (@ftp_pasv($this->_conn, true) === false) {
JError::raiseWarning('36', 'JFTP::create: Unable to use passive mode');
return false;
}
$buffer = fopen('buffer://tmp', 'r');
if (@ftp_fput($this->_conn, $path, $buffer, FTP_ASCII) === false) {
JError::raiseWarning('35', 'JFTP::create: Bad response');
fclose($buffer);
return false;
}
fclose($buffer);
return true;
}
// Start passive mode
if (!$this->_passive()) {
JError::raiseWarning('36', 'JFTP::create: Unable to use passive mode');
return false;
}
if (!$this->_putCmd('STOR '.$path, array (150, 125))) {
@ fclose($this->_dataconn);
JError::raiseWarning('35', 'JFTP::create: Bad response', 'Server response: '.$this->_response.' [Expected: 150 or 125] Path sent: '.$path);
return false;
}
// To create a zero byte upload close the data port connection
fclose($this->_dataconn);
if (!$this->_verifyResponse(226)) {
JError::raiseWarning('37', 'JFTP::create: Transfer Failed', 'Server response: '.$this->_response.' [Expected: 226] Path sent: '.$path);
return false;
}
return true;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />