大致有这么些函数ftp_pwd — Returns the current directory name ftp_cdup — Changes to the parent directory ftp_chdir — Changes directories on a FTP server ftp_mkdir — Creates a directory ftp_rmdir — Removes a directory ftp_nlist — Returns a list of files in the given directory.然后上传代码是<?php // 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"); // check connection if ((!$conn_id) ¦¦ (!$login_result)) { echo "Ftp connection has failed!"; echo "Attempted to connect to $ftp_server for user $user"; die; } else { echo "Connected to $ftp_server, for user $user"; }// upload the file $upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY); // check upload status if (!$upload) { echo "Ftp upload has failed!"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file"; }// close the FTP stream ftp_quit($conn_id); ?>
你确定是php的错吗?
ftp_cdup — Changes to the parent directory
ftp_chdir — Changes directories on a FTP server
ftp_mkdir — Creates a directory
ftp_rmdir — Removes a directory
ftp_nlist — Returns a list of files in the given directory.然后上传代码是<?php
// 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"); // check connection
if ((!$conn_id) ¦¦ (!$login_result)) {
echo "Ftp connection has failed!";
echo "Attempted to connect to $ftp_server for user $user";
die;
} else {
echo "Connected to $ftp_server, for user $user";
}// upload the file
$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY); // check upload status
if (!$upload) {
echo "Ftp upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}// close the FTP stream
ftp_quit($conn_id);
?>
<input type="hidden" name="MAX_FILE_SIZE" value="10485760">
<input type="hidden" name="mid" value="<?php echo $mid; ?>">
<INPUT TYPE="hidden" name="besubmit" value="1">
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="s6" align="center">
<tr>
<td align="left" valign="top" width="11%"><img src="t4.gif" width="2" height="2"></td>
<td align="right" valign="top" width="89%"><img src="t7.gif" width="2" height="2"></td>
</tr>
<tr valign="top">
<td colspan="2" align="left" height="183">
<table width="98%" border="0" cellspacing="1" cellpadding="0" align="center">
<tr>
<td width="50%">您正在<b>[ <?php echo $label; ?> ]</b>栏目中上载作品</td>
<td align=left><b>上载声明:</b></td>
</tr>
<tr>
<td><?php if ($mid!='pic') { ?>文件:<input name="upfile" type="file" class="box1"> <?php } ?></td>
<td></td>
</tr>
<tr>
<td>图片:<input name="upimg" type="file" class="box1"></td>
<td rowspan="6" valign="top">
1. 我们将认真对待每一个作品。<br>
2. 只有经过审批合格才给予发布,请在[待审作品]中查看您的上传。<br>
3. 所有作品不用于商业用途。<br>
4. 文件大小限制在10M以内。<br>
5. 支持以下文件格式:<?php echo str_replace('|',',',$exts[$mid]); ?>。<br>
6. 支持以下图片格式:<?php echo str_replace('|',',',$exts['pic']); ?>。<br>
7. 为了方面我们也方便大家,请填写每一项内容。<br>
8. 支持HTML描述。
</td>
</tr>
<tr><td>名称:<input name="name" type="text" value="<?php echo $name; ?>" class="box1"></td></tr>
<tr><td>
分类:<SELECT NAME="cid" class="box1">
这里你可以自己写option
</SELECT>
</td></tr>
<tr><td>来源:<input name="source" type="text" value="<?php echo $source; ?>" class="box1"></td></tr>
<tr><td>姓名:<input name="upman" type="text" value="<?php echo $upman; ?>" class="box1"></td></tr>
<tr><td>简介:<br><TEXTAREA NAME="intro" ROWS="5" COLS="35" class="box2"></TEXTAREA></td></tr>
<tr>
<td><INPUT TYPE="submit" name="submit" value=" 上 传 " class="box2"> <INPUT TYPE="reset" value=" 清 除 " class="box2"></td>
<td align=right>[<a href="#" onClick="window.close()">关闭窗口</a>]</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="bottom" width="11%"><img src="t5.gif" width="2" height="2"></td>
<td align="right" valign="bottom" width="89%"><img src="t6.gif" width="2" height="2"></td>
</tr>
</table>
</form>这是我以前用~~好象是这一段