hi all..
i changed my code like below:
now i am getting the error
Warning: Unable to open 'Array' for reading: No such file or directory in /var/www/html/mohuploadcv.php on line 55
ERROR UPLOADING FILE!
all permissions are there in that directory...
pls help
ckb
my php code is
<?php
session_start();
$todayyear=date('Y');
//check if the user has been registered or not
//if(!session_is_registered("SESSION_UID"))
if(!isset($_SESSION['SESSION_UID']))
{
header("LOCATION:ERROR.PHP?ec=1");
exit;
}
include("connection.php");
?>
<html>
<head>
<title>Attach CV </title>
<body bgcolor="#FCFBE9">
</head>
<body>
<?
$connection=mysql_connect($hostname,$user,$pass)
or die ("Unable to connect to the database");
$query4= "Select max(applicant_id) as cvid from moh_job_app";
$result4=mysql_db_query($database,$query4,$connection)
or die("Error in query:$query4.". mysql_error());
if(mysql_num_rows($result4)==0)
{
mysql_close($connection);
}
else
{
list($maxcvid) = mysql_fetch_row($result4);
if(isset($POST['submit']) && isset($FILES['file1']) && $_FILES['file1'] !=
"none") {
$uploadfile=$_FILES['file1'];
//$filehandle = fopen($file1, "r");
//$filesize = filesize($file1);
//$buffer = addslashes(fread($filehandle, $filehandle));
$fname= $maxcvid . $uploadfile;
// $data = addslashes(fread(fopen($uploadfile,"r"), filesize($uploadfile)));
$uploaddir = "/var/www/html/upload/";
$newfile = $uploaddir . $fname;
if(copy($uploadfile, $newfile)) {
// if(move_uploaded_file($uploadfile, $newfile)) {
print("<h5><center> UPLOAD SUCCESSFUL!</h5></center>");
$connection=mysql_connect($hostname,$user,$pass)
or die ("Unable to connect to the database");
// sql= "Select cvname from mohjob where applicant_id = (SELECT max(applicant_id)
from mohjob)" ;
/$query= "update mohjob
set cvname='$fname'
where applicant_id = (SELECT max(applicant_id) from mohjob)"; /
//$vmaxcvid=$_POST['maxcvid'];
$query= "update moh_job_app
set cvname='$fname'
where applicant_id = '$maxcvid'";
echo"<center>Click <a href
='moh_experience.php?email={$_SESSION['SESSION_UID']}'>here</a> to go to Experience
Page</center>";
echo"<body bgcolor=#FCFBE9>";
// header("LOCATION:moh_experience.php");
$result=mysql_db_query($database,$query,$connection)
or die("Error in query:$query.". mysql_error());
mysql_close($connection);
} else {
print("<h3><center>ERROR UPLOADING FILE!</h3></center>");
echo"<body bgcolor=#FCFBE9>";
}} else {
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" [ccc]
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value=" 2097152">
<align=left><u>Attach CV</u> <br>
<br>File:<input type="file" name="file1">
<br><input type="submit" name="submit" value="UPLOAD"><br>
<br><font size=2><B> If you do not attach your CV, your application will not be
considered.</b>
</form>
<?
}
}
?>
</body>
</html>