Mailserver till min hemsida som jag hostar själv
Tjena jag skulle vilja att någon beskriver hur jag får Mercury att ansluta till min webserver och sedan skicka mail till min riktiga mailadress.
Har följt guider på internet men det funkade inte.
Sen har jag ett problem med min kod>
<?php
$filepath='http://localhost/choklad/'; //http file path
// Configuration - Your Options
$allowed_filetypes = array('.jpg,'.gif','.bmp','.png'); // These will be the types of file that will pass the validation.
$max_filesize = 524288000; // Maximum filesize in BYTES (currently 500MB).
$upload_path = './choklad/'; // The place the files will be uploaded to (currently a 'files' directory).
$filename = $_FILES['file']['name']; // Get the name of the file (including file extension).
$displayName=$filename;
if(file_exists('/choklad/'.$filename)){
$filename=hash_file('sha256',$_FILES['file']['tmp_name']).'_'.$filename;
}
$ext = pathinfo($filename, PATHINFO_EXTENSION); // Get the extension from the filename.
$size=$_FILES['file']['size'];
$ip=$_SERVER['REMOTE_ADDR'];
// Check if the filetype is allowed, if not DIE and inform the user.
//if(!in_array($ext,$allowed_filetypes))
// die('The file you attempted to upload is not allowed.');
// Now check the filesize, if it is too large then DIE and inform the user.
if(filesize($_FILES['file']['tmp_name']) > $max_filesize)
die('The file you attempted to upload is too large.');
// Upload the file to your specified path.
if(move_uploaded_file($_FILES['file']['tmp_name'],$upload_path . $filename)){
$addToDb=mysqL_query("INSERT INTO files (name,displayName,ext,size,ip)VALUES('$filename','$displayName','$ext','$size','$ip')") or die (mysql_error());
echo '<a href="' . $upload_path . $filename . '" title="Your File">'.$filepath.$filename.'</a>'; // It worked.
}
else{
echo 'There was an error during the file upload. Please try again.'; // It failed :(.
}
?>
Den ska bara tillåta dom filtyper jag valt men det funkar inte jag kan lada upp alla sorter.
(jpg,png,gif,bmp) Ska vara dom tillåtna, vad är mitt fel?
//Skum-tomte