Hi. all you coders out there... I need your help. I have been trying to get a php script to UL 1 or 2 images to a folder (that is writable) on the server after the image is UL the php script will email, with the information that the user puts in on the contacts page (there email, subject, comment and manly the link to the image file that was UL on server).
Here is what the UL script look like (remember this is NOT the conact pg).
<?php
//Attemped 6b
$error = 0;
///keep working on this line... does not LIKE!!!!!!!! Getting " Not expecting "(" error"
if (($subject == "") ($name == "") ($address == "") ($email == "") ($comment == "") ($file1 == ""));
{
$error = 1;
}
if ($error == 1)
{
$l = "Location: http://www.anifran.org/contact.php?error=1";
$l .="&subject=$subject&name=$name&address=$address&email=$email&comment=$comment&file1=$file1";
header($l);
exit;
}
//Define some variables
foreach($_FILES as $value) {
foreach($value as $k => $v) {
echo $k.' => '.$v.'';
}
}
if($_FILES['fileatt']['name'] == '') {
echo 'You did not select a photo to upload';
}
elseif($_FILES['fileatt']['size'] == 0) {
echo 'There appears to be a problem with the photo your are uploading';
}
elseif($_FILES['fileatt']['size'] > $MAX_FILE_SIZE) {
echo 'The photo you selected is too large';
}
elseif(!getimagesize($_FILES['fileatt']['tmp_name']))
{
echo 'The photo you selected is not a valid image file';
}
else {
$uploaddir = '/var/www/imageuploads/'; // remember the trailing slash!
$uploadfile = $uploaddir . $_FILES["fileatt"]['name'];
if(move_uploaded_file($_FILES['fileatt']['tmp_name'], $uploadfile))
{
echo 'Upload file success!';
}
else {
echo 'There was a problem uploading your file.';
print_r($_FILES);
}
}
$youremail="webmaster@anifran.org";
$emailsubject="Image Restoration";
$from_who="<>";
$pagetitle="Thank You!";
if (getenv(HTTP_CLIENT_IP)){
$user_ip=getenv(HTTP_CLIENT_IP);
}
else {
$user_ip=getenv(REMOTE_ADDR);
}
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$datafile = $_POST['datafile'];
$mailbody="Senders Name:\n=================\n$name\n\n";
$mailbody.="Senders Email:\n=================\n$email\n\n";
$mailbody.="Senders Comments:\n=================\n$comments";
mail("$youremail", "$emailsubject", "$mailbody", "From: $from_who"); // Sends the email.
$comments = nl2br($comments);
$k = "Location: http://www.anifran.org/sent.php?";
header($k);
?>
That is the hole php script. The contact page is calling up this script (UL.php) file and that is what run the UL comands and emails or at lest should if i ever get it right...
Thanks
