PHP Code:
function control($val,$min,$max,$ctype,$check)
{
-----
}
function userdata()
{ if(isset($_POST['btnSub2']))
{$resume_file_name = str_replace('_','',$_FILES['filename']['name']);
$file_error = $_FILES['filename']['error'];
if(!is_numeric($strno))
{
echo "Phone/Mobile Should be Numeric";
}
else
{
$upload = false;
echo "4Phone/Mobile Should be Numeric";
$explode_file = explode('.',$filename);
$extension_supplied = $explode_file[count($explode_file) - 1];
$extension_allowed = array('.doc','.docx');
for($check=0; $check<count($extension_allowed); $check++)
{if($extension_supplied == $extension_allowed[$check])
{$upload = true;}
}
// current timestamp //
$timestamp = time();
// temporary file name //
$tmp_file_name = strtolower($firstname)."_".strtolower($lastname)."_".$timestamp."_".$filename;
// target directory //
$target = "abc/resume_coll/".$tmp_file_name;
echo ".$target ,.$temp_file_name ";
if($upload == true)
{// connecting to database server //
$sql=mysql_connect('db42.db.com','dbo4256938','abcd123');
if (!$sql)
{die('Connection failed: ' . mysql_error());
}else
{ echo "Connection to MySQL server successful!";
} $sql = mysql_select_db($db4256938);
---------
-------
if(is_uploaded_file($_FILES['filename']['tmp_name']))
{
if(move_uploaded_file($_FILES['filename']['tmp_name'],$target))
{
$message ="
<table>-----<tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/$tmp_file_name>Download Now</a></td></tr>
----- </table>
$receiver = 'abc@xyz.com';
$subject = "Resume Uploaded by ".ucwords($firstname)." ".ucwords($lastname);
echo "in resume upload";
$headers = "From:".$email."\r\n"."Reply-To:".$email."\r\n";
$headers .= "Content-type: text/html\r\n";
//$message = htmlentities($message);
$mail = mail($receiver,$subject,$message,$headers);
if($mail)
{
echo "You will receive a confirmation E-mail with User Name and Password information "; }
else
{
echo "Invalid File Extension (<b>$extension_supplied</b>) to Upload.";
}function execute_code()
{
return userdata();
}
echo execute_code();
hi, i am trying to upload the file in target path(folder) but m getting error as invalid File Extension to upload(). kindly help me
Bookmarks