Hi, Am not noob with php.. but i was a starter.. i know a little of basic of php's magic..
here we go////
Am looking for a script to upload a .rec file along with the data of the uploader.. i did some php scripting .. it works on upload but its not taking the fields.. may be i missed or i really dont know how to include them...
other words... i want to include the name in the field and the result along with the upload... or even the upload file name can also have this field its good for me...
My HTML SCRIPT
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td><center> <strong> KGR TOURNAMENT RESULTS/RECORDS </strong></center></td>
</tr>
<tr>
<td>Select file
<input name="ufile" type="file" id="ufile" size="50" /></td>
</tr>
<center><TABLE class="blacktext">
<p><select name=WHO>
<option value="[_EnG_] YOU">[_EnG_] YOU
<option value="[_EnG_] GoCodes">[_EnG_] GoCodes
</select>
<select name=RESULT_1>
<option value="[0]">[0]
<option value="[1]">[1]
<option value="[2]">[2]
</select>
...::::::: vS :::::::...
<select name=YOU>
<option value="[_EnG_] WHO">[_EnG_] WHO
<option value="[_EnG_] GoCodes">[_EnG_] GoCodes
</select>
<select name=RESULT_2>
<option value="[0]">[0]
<option value="[1]">[1]
<option value="[2]">[2]
</select>
</p>
</center>
<tr>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
My Php Script
<?php
// Your file name you are uploading
$file_name = $HTTP_POST_FILES['ufile']['name'];
// random 4 digit to add to our file name
// some people use date and time in stead of random digit
$ip_address=getenv("REMOTE_ADDR");
$random_digit=rand(1,99);
//combine random digit to you file name to create new file name
//use dot (.) to combile these two variables
$new_file_name=$ip_address.$random_digit.$file_name;
//set where you want to store files
//in this example we keep file in folder upload
//$new_file_name = new upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>";
//$new_file_name = new file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$new_file_name."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>";
}
else
{
echo "Error";
}
}
?>
My English is bit bad.. cos i dont study english at school . thanks