Forum Moderators: coopster
upload.php
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="frm_upload" id="frm_upload">
<table border="0" cellspacing="0" cellpadding="0" id="tbl_upload">
<tr>
<th scope="row"><label for="frmname">Full name:</label></th>
<td><input type="text" name="frmname" id="frmname" class="frmfld" /></td>
</tr>
<tr>
<th scope="row"><label for="frmfile">File:</label></th>
<td><input name="frmfile" type="file" id="frmfile" size="30" /></td>
</tr>
<tr>
<th scope="row"> </th>
<td>
<label for="btn" id="sbm">
<input type="submit" name="btn" id="btn" value="Upload" />
</label>
</td>
</tr>
</table>
</form>
<pre>
<?php
if (array_key_exists('btn', $_POST)) {
print_r($_FILES);
// define new constant which contains the path to the upload folder
define('UPL_FLD','uploads/');
// move file to the 'uploads' folder
move_uploaded_file($_FILES['frmfile']['tmp_name'],UPL_FLD.$_FILES['frmfile']['name']);
}
?>
</pre>
</body>
</html>
my result - with error 6 no temporary file
Array
(
[frmfile] => Array
(
[name] => 812sm.jpg
[type] =>
[tmp_name] =>
[error] => 6
[size] => 0
)
)
e.g.
define("UPL_FLD", "/var/www/html/uploads");
define("UPL_FLD", "/public_html/uploads");
also by default your system might have a 2M php upload limit, which you can override easily, fyi.