Hi there,
Earlier i posted a request for some help regarding the attaching an attachment to an email, however, i have now opted to just upload the file to the web server, as quite frankly i cannot be arsed with the attachemnt part any more! lol
Anyway, i have tried to add an upload script to upload the file into the mail.php script, so, basically, it emails me the form information, but uploads the attachment to the web server.
However, its sending the email fine, but not uploading the file 🙁
There is no error message appear.
I attach the code below. Any help would be great, as this is really getting on my tits!
Ive tried everything!!
Thanks
Jonathan
====
<?php
$file_dir = "/usr/local/psa/home/vhosts/edynamics.co.uk/httpdocs/update_uploads";
// Check to see if user has completed ALL boxes
if($company_name && $address && $city && $state && $zip_code && $phone_number && $email_address && $update) {
// Check that the email is valid by checking for '@' symbol
if (strrpos($email_address,'@') > 0) {
// Send The eMail to WaschiDesign.com
mail("j.dunn5@ntlworld.com", "Website Contact", "
Company Name: $company_name
Address: $address
City: $city
State: $state
Zip Code: $zip_code
Phone Number: $phone_number
Email Address: $email_address
Remote Address (Incase of Abuse): $REMOTE_ADDR
$update
To reply to this email, simply click reply using your email agent.", "From: $email_address");
// Upload File Attachments to Web Server
foreach($_FILES as $upload => $file_array) {
print "path: ".$file_array['tmp_name']."<br>\n";
print "name: ".$file_array['name']."<br>\n";
print "type: ".$file_array['type']."<br>\n";
print "size: ".$file_array['size']."<br>\n";
if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or die ("Couldn't copy");
print "Your email has been sent, and your attachment has been sucessfully uploaded to our servers. Thankyou!";
}
}
} else {
print "Email Invalid.";
}
} else {
print "Please complete all boxes.";
}
?>
===