Server Question
- Started
- Last post
- 26 Responses
- hubb7designs
So I built a contact form for a client where the user will fill out the form and upload their resume to apply for a job.
The PDF resumes go to an "uploads" directory on my server.
Now I'm trying to figure out the best way for my client to access/download the resumes that are uploaded.
I was thinking that I could try and see if I could have a folder on my desktop (mac) that would sync up with the folder/directory on the server. But I don't know if this is possible or the best way.
Any suggestions?
- vaxorcist0
You can more easily setup your script to email the client (and you) the form info every time somebody uploads a resume, with a link like
- hubb7designs0
^^How would I could that in php?
- hubb7designs0
// Where the file is going to be placed
$target_path = "uploads/";/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name...$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name...
if(move_uploaded_file($_FILES['u... $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name...
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
- hubb7designs0
^^ So here is the php that grabs the file and moves it to the uploads folder on the server.
And I can see the echo, that will return the information about the PDF that is being uploaded.
I just need to know how to add this into my $header =
- hubb7designs0
^^ So here is the php that grabs the file and moves it to the uploads folder on the server.
And I can see the echo, that will return the information about the PDF that is being uploaded.
I just need to know how to add this into my $header =
- vaxorcist0
you don't have to add a header....
just write a URL string into the email message body.
$message.= "RESUME PDF:\n http://www.you.com/" .$target_path;
NOTE: I'd add a timestamp or random number or some variable to the filename before you write the file... so that the people who all name their resume file "resume.pdf" don't erase each others files on the server... and your download link only shows the last upload....
$last_name_pdf=$last_name.".pdf...
$target_path=str_replace("pdf...do this before you write the file and write the email body text...
- QBN seems to chop up code... but you know how to use str_replace by now...vaxorcist
- I actually don't. Still very new to PHP codinghubb7designs
- hubb7designs0
Here is the section that calls the $headers and $message:
I tried just starting with the coding you recommended:
$message.= "RESUME PDF:\n http://www.you.com/".$targe…
But the email still came through with nothing.
- I'm really starting to think this PHP code I have is turning into a Frankenstein!hubb7designs
- hubb7designs0
I'm getting this returned:
print_config: email
Name:
Addresss:
HomePhone:
CellPhone2:
email:
SecurityClearance:
SecurityClearance2:
submit_x: 111
submit_y: 8I didn't key in any info to see if it would error, but it didn't. But the files are still going to the uploads folder on my server.
- vaxorcist0
the files are going to the uploads dir, that's good...
the email you're sending is too complex, you don't need to attach the PDF to the email, just point to it on the server...
- hubb7designs0
Again my lack of PHP is showing...
I didn't write up any of this script, I'm simply trying to get it to work for me, with little success.
I can see where the $message codes are, but I'm not understanding how I can pull the pieces of information together and have the server email a link to the newly uploaded PDF files on the server.
Thanks for ALL the help so far too vaxorcist, you're a life saver.
- vaxorcist0
I'd cut out the mail section, start with a plain email script based on the mail() function in PHP.
If your variables aren't coming through, check that your form is POST or GET... if so..
$var=$_POST['var'];
print "<P>var:$var";
$message.="var:$var";
- vaxorcist0
hmmm..... I'll look at your code....
- hubb7designs0
Here is the HTML:
http://pastie.org/1571646And here is the PHP:
http://pastie.org/1571647
- vaxorcist0
waaay more complex than you need, but okay.... I'll look around a bit...
- ESKEMA0
Mountee seems like a good choice, or something similar...
http://hellomountee.com/- just mount your "uploads" folder on your machine.
Total access to its content on the fly.ESKEMA
- just mount your "uploads" folder on your machine.
- ESKEMA0
^^Sorry. wrong app. I thought it would be this one, but confused. I was aiming at an app that lets you easily mount remote folders like transmit does...
- hubb7designs0
^^^ That would be somewhat of an option too. But I couldn't find an app that would do that for me.
- vaxorcist0
hmmm... I may want to go download original code... getting a parse error on the PHP you linked to...
- vaxorcist0
argh, I'm booked tonight, may be able to look more tomorrow...