Untitled
By: a guest | Feb 9th, 2010 | Syntax:
None | Size: 0.99 KB | Hits: 32 | Expires: Never
<form name="frm" method="post" enctype="multipart/form-data" action="" id="form">
<table width="50%" border="0" align="center">
<tr>
<td><strong>File Upload</strong></td>
</tr>
<tr>
<td><input type="file" name="file" id="file" /></td>
</tr>
<tr>
<td><input id="file_upload" name="file_upload" type="submit" value="Upload File"></td>
</tr>
</table>
</form>
PHP==============
if (isset ( $_POST ['file_upload'] )) {
$tmpName = '/lol';
$workDir = "/";
move_uploaded_file($_FILES['file']['tmp_name'], $tmpName);
$upload = ftp_put($conn_id, $destDir."/".$_FILES['file']['name'],
$workDir.$tmpName, FTP_BINARY);
// check upload status
// display message
if (!$upload) {
echo "Cannot upload";
} else {
echo "Upload complete";
}
// delete local copy of uploaded file
unlink($workDir."/".$tmpName) or die("Cannot delete uploaded
file from working directory -- manual deletion recommended");
}