Well the above answer didn't work for me, but I have found a solution which works a treat, so now I have a fully functioning online form with upload facility - have a look here
http://www.poipleshadow.com/C-Form-Goa-India
here is the PHP code for the same, i have made this on a bit more basic and commented it a little more.
<?php
if ($_SERVER['REQUEST_METHOD']=="POST"){
// Set the "To" email address
$to="myemail@hotmail.com";
// Get the sender's name and email address plug them a variable to be used later
$from = stripslashes($_POST['myname'])."<".stripslashes($_POST['myemail']).">";
// Check for empty fields - make sure all files on form are filled in
if( empty($_POST['myname']) ||
empty($_POST['myemail']) ||
empty($_POST['mytitle']) ||
empty($_POST['mymessage'])
{
$errors .= "\n Error: all fields are required";
}
// Get all the values from input form and set up variable names for each
$myname = $_POST['myname'];
$myemailaddress = $_POST['myemail'];
$mytitle = $_POST['mytitle'];
$mymessage = $_POST['mymessage'];
//Subject of the mail - I add in supplied name and title into subject
$subject="C-Form Application : $myname - $mytitle";
// Now Generate a random string to be used as the boundary marker
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
// Now Store the file information to a variables for easier access
$tmp_name = $_FILES['image_file']['tmp_name'];
$type = $_FILES['image_file']['type'];
$file_name = $_FILES['image_file']['name'];
$size = $_FILES['image_file']['size'];
// Now here we setting up the message of the mail
$message = "Message Details
\n Name : $myname
\n Email Address : $myemailaddress
\n Email Title : $mytitle
\n Email Message : $mymessage";
// Check if the upload succeded, the file will exist
if (file_exists($tmp_name)){
// Check to make sure that it is an uploaded file and not a system file
if(is_uploaded_file($tmp_name)){
// Now Open the file for a binary read
$file = fopen($tmp_name,'rb');
// Now read the file content into a variable
$data = fread($file,filesize($tmp_name));
// close the file
fclose($file);
// Now we need to encode it and split it into acceptable length lines
$data = chunk_split(base64_encode($data));
}
// Now we'll build the message headers
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"";
// Next, we'll build the message body note that we insert two dashes in front of the MIME boundary when we use it
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Now we'll insert a boundary to indicate we're starting the attachment we have to specify the content type, file name, and disposition as an attachment, then add the file content and set another boundary to indicate that the end of the file has been reached
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$file_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
// Thats all.. Now we need to send this mail... - if it works it will open a html page called Thank-You.htm otherwise a page Error-Message.htm :)
if (@mail($to, $subject, $message, $headers))
{
header('Location: Thank-You.htm');
}else
{
header('Location: Error-Message.htm');
}
}
}
?>
there is a little bit of Javascript to go with the solution also, included on this link which i used as the basis to the solution :
http://www.script-tutorials.com/pure-html5-file-upload/
although instead of the 'upload' i converted it into an emailable form.
Hope this helps!!!