View Single Post
Old Jun 25th, 2005, 10:42 AM   #2
skuinders
Hobbyist Programmer
 
skuinders's Avatar
 
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4 skuinders is on a distinguished road
you need to use a server side language... have the HTML form post to a PHP page like this:

HTML:
<form enctype="multipart/form-data" action="submit.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<table>
	<tr>
		<td>Name: </td>
		<td><input type="text" name="name"></td>
		<td>Password: </td>
		<td><input type="password" name="passwd"></td>
		<td>File: </td>
		<td><input type="file" name="userfile"></td>
		<td>email: </td>
		<td><input type="text" name="email"></td>
	</tr>
</table>
<input name="action" type="submit" value="Submit">
</form>

PHP: (upload code)
$uploadDir = 'uploads/';
$filename=trim($_FILES['userfile']['name']);
$uploadFile = $uploadDir . $filename;
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile)) {	
	print "file was successfully uploaded. <br />";
}
else {
	print "Upload failed!  Here's some debugging info: \n";
	print_r($_FILES);	
}

and if you are going to do anything with the other fields you should think about using a MySQL database. go to http://www.php.net/mysql for some more info on that.
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand."
- B. Russell

http://web.bryant.edu/~srk2
skuinders is offline   Reply With Quote