Hi,
I've written a program to upload a file... this program uploads the files into specified folder.. but i want to put the file name into mysql database too... if i check a file name php shows me a temp file name...
plz help me out how can i put the original uploaded file name to database... i'm new in php.
here is my code:
<head><title>Upload</title></head><BODY bgcolor="#666666" text="#C0C0C0" link="#CCCCCC" alink="#9999FF" vlink="#999999" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0 rightmargin=0>
<form method="post" action="upload2a2.php" enctype="multipart/form-data">
<input name="userfile" type="file">
<input type="text" name="aa">
<input type="submit" value="upload now..." >
</form>
<?
echo ("File name is ".$userfile."<br>");
echo ("Text box message is ".$aa);
for($i=0;$i<sizeof($userfile);$i++)
{
if(!$userfile_size)
continue;
$UPLOAD = fopen( $userfile, "r" );
$contents = fread( $UPLOAD,$userfile_size);
fclose( $UPLOAD );
$SAVEFILE = fopen( "upload//".$userfile_name, "wb" );
fwrite( $SAVEFILE, $contents,$userfile_size);
fclose( $SAVEFILE );
}
echo "File Uploaded Successfully";