- <?php
-
// Check if a file has been uploaded
-
if(isset($_FILES['uploaded_file'])) {
-
// Make sure the file was sent without errors
-
if($_FILES['uploaded_file']['error'] == 0) {
-
// Connect to the database
-
$dbLink = new mysqli('localhost', 'root', '', 'jobsearch');
-
if(mysqli_connect_errno()) {
-
die("MySQL connection failed: ". mysqli_connect_error());
-
}
-
-
// Gather all required data
-
$name = $dbLink->real_escape_string($_FILES['uploaded_file']['name']);
-
$mime = $dbLink->real_escape_string($_FILES['uploaded_file']['type']);
-
$data = $dbLink->real_escape_string(file_get_contents($_FILES ['uploaded_file']['tmp_name']));
-
$size = intval($_FILES['uploaded_file']['size']);
-
-
$fname=$_POST['fname'];
-
$lname=$_POST['lname'];
-
$emailid=$_POST['emailid'];
-
$country=$_POST['country'];
-
$city=$_POST['city'];
-
$bdate=$_POST['bdate'];
-
$bmonth=$_POST['bmonth'];
-
$byear=$_POST['byear'];
-
$gender=$_POST['gender'];
-
$contact=$_POST['contact'];
-
$degree=$_POST['degree'];
-
$major=$_POST['major'];
-
$gpa=$_POST['gpa'];
-
$cmonth=$_POST['cmonth'];
-
$cyear=$_POST['cyear'];
-
$jobtype=$_POST['jobtype'];
-
$exp=$_POST['exp'];
-
$indus=$_POST['indus'];
-
$jobfunction=$_POST['jobfunction'];
-
$keyskill=$_POST['keyskill'];
-
$resumetile=$_POST['resumetile'];
-
-
-
-
//This is the directory where images will be saved
-
$target = "resumes/";
-
$target = $target . basename($_FILES['uploaded_file']['name']);
-
-
// Create the SQL query
-
$query = "
-
INSERT INTO ` jobseeker` (
-
`name`, `mime`, `size`, `data`, `fname`, `lname, `emailid`, `country`, `city`, `bdate`, `bmonth`, `byear`, `gender`, `contact`, `degree`, `major`, `gpa`, `cmonth`, `cyear`, `jobtype`, `exp`, `indus`, `jobfunction`, `keyskill`, `resumetile`,`created`
-
)
-
VALUES (
-
'{$name}', '{$mime}', '{$size}', '{$data}', '{$fname}', '{$lname}', '{$emailid}', '{$country}', '{$city}', '{$bdate}', '{$bmonth}', '{$byear}', '{$gender}', '{$contact}', '{$degree}', '{$major}', '{$gpa}', '{$cmonth}', '{$cyear}', '{$jobtype}', '{$exp}', '{$indus}', '{$jobfunction}', '{$keyskill}', '{$resumetile}', NOW()
-
)";
-
-
-
-
// Execute the query
-
$result = $dbLink->query($query);
-
-
-
//Writes the photo to the server
-
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $target))
-
{
-
-
//Tells you if its all ok
-
//echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
-
}
-
else {
-
-
//Gives and error if its not
-
echo "Sorry, there was a problem uploading your file.";
-
}
-
-
-
-
// Check if it was successfull
-
if($result) {
-
echo 'Success! Your file was successfully added!';
-
}
-
else {
-
echo 'Error! Failed to insert the file'
-
. "<pre>{$dbLink->error}</pre>";
-
}
-
}
-
else {
-
echo 'An error accured while the file was being uploaded. '
-
. 'Error code: '. intval($_FILES['uploaded_file']['error']);
-
}
-
-
// Close the mysql connection
-
$dbLink->close();
-
}
-
else {
-
echo 'Error! A file was not sent!';
-
}
-
-
// Echo a link back to the main page
-
echo '<p>Click <a href="newfile.html">here</a> to go back</p>';
-
?>
-
-
(
0 1414 Sign in to post your reply or Sign up for a free account.
Similar topics
by: ADE |
last post by:
Hi everyone well from my last post I found what I am looking for
I have some code now that transfers files
I have added a GUI to it and need some help with two things one my
loadtemplate()...
|
by: Sridhar Reddy |
last post by:
Hi,
Where can i get the download mysql.sock file?
I am unable to connect to local server because i dont have this file?
thanx in advance
Sridhar
|
by: Jacek Francuz |
last post by:
Hi!
How can I change button image end send file to Client in one request?
I try to change image in first step and I add onstartupscript:
"Form1.submit()" and then in second step I send...
|
by: SM |
last post by:
Hello,
Im trying to access elements in my XML file using the JavaScript DOM
but i'm not sure how. I use AJAX to access the XML and then use the
responseXML property to access the XML file data.
I...
|
by: Rahulnewdelhi |
last post by:
hello all
Hello all
I installed php, mysql and IIS in xp. Problem is this while i run following file
PHP Code:
----------------
<?php
|
by: ic3s |
last post by:
I need help in completing my program that sends files using java.
What I wanted, instead of putting the text in a string then send, I want to save it to file in my local drive and the program would...
|
by: malaysiauser |
last post by:
Im new user of PHP and MySQL.
I tried to use a script package for my web. I'd created a database.
And my connection scripts are as follow;
<?php
$mysql_host="localhost";
...
|
by: vyasanjali |
last post by:
Hi
I am trying to my site user to a other site api using SOAP client .
But Every time its give uncatchable error.
I am using nusoap class .But shows error that given below:
Fatal error:...
|
by: phanimadhav |
last post by:
hello friends i need your help.Any one please help me.
Actually my client requirement is store the .doc file into MYSQL .So please help me if u have any code or any url please send me.Thank you
|
by: Francesca |
last post by:
Hi everybody,
I am a real newbie in both perl and relational databases like mysql, and I have been banging my head on the wall trying to understand how to populate a mysql database using an Excel...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |