this form to select a file below there is action file with database fun!!!
<html>
<head>
</title></title>
</head>
<body>
<form name=form1 action=image_upload_admin_action.php method=post enctype=multipart/form-data>
<input type=file name=FileToUpload>
<input type=hidden name=MaxFileSize value=64000><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
<?php
//**************************************
// Name: Upload file, make name unique, save in MySql DB
//It also checks the size of the file so you can give a maximum
//size for all files that will be uploaded.
//$FileToUpload=$REQUEST["FileToUpload"];
//$MaxFileSize=$REQUEST["MaxFileSize"];
/*
if ($FileToUpload_type == 'image/gif') {
$type = '.gif';
}
if ($FileToUpload_type == 'image/pjpeg') {
$type = '.jpg';
}
if ($FileToUpload_type == 'image/x-png') {
$type = '.jpg';
}
//$newfile = substr($FileToUpload, -9);
//$newfile = $FileToUpload;
if($FileToUpload_name = '')
{
print("No file was selected!");
}
elseif($FileToUpload_size > $MaxFileSize)
{
print("The file to upload is too big");
}
else {
*/
//$global_db = mysql_connect('localhost', 'User', 'Password');
//mysql_select_db('DBName', $global_db) or die("Connection error");
//$query = "INSERT INTO Filetable (File) VALUES ('$newfile$type')";
//$result = mysql_query($query) or die("ERROR");
//move_uploaded_file($FileToUpload, "upload/$newfile$type") or die ("file could not be uploaded");
move_uploaded_file($FileToUpload, "upload/$FileToUpload_name") or die ("file could not be uploaded");
// }
?>