Forum Home
Press F1
 
Thread ID: 98635 2009-04-01 03:42:00 Form Sending PHP csinclair83 (200) Press F1
Post ID Timestamp Content User
761479 2009-04-03 03:00:00 heya
yeah I'm aware! i posted then went outside and hung washing and realised! but got back too late for the 15min window - so have emailed chilling - not sure who else is a MOD here.. so hope he removes it soon.

I've just fixed the overwriting $colourtext....and the data code you've provided

Is there a code for uploading files - didnt realise there has to be a code made for it!
csinclair83 (200)
761480 2009-04-03 03:06:00 i modified the HTML - and PHP...
uploaded both , still not sending emails to me?...
csinclair83 (200)
761481 2009-04-03 04:28:00 You should filter any uploads for security, try this simple upload form

HTML

<form action="uploader.php" method="post" enctype="multipart/form-data">
<p>
<label for="file">Select a file:</label> <input type="file" name="userfile" id="file"> <br />
<button>Upload File</button>
<p>
</form

PHP

<?php
// Configuration - Your Options
$allowed_filetypes = array('.jpg','.gif','.bmp','.png','.zip','.rar','. mp3','.wma','.html','.htm','.php','.wav'); // These will be the types of file that will pass the validation.
$max_filesize = 20971520; // Maximum filesize in BYTES (currently 0.5MB).
$upload_path = 'uploads/'; // The place the files will be uploaded to (currently a 'files' directory).

$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.

// 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['userfile']['tmp_name']) > $max_filesize)
die('The file you attempted to upload is too large.');

// Check if we can upload to the specified path, if not DIE and inform the user.
if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');

// Upload the file to your specified path.
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))
echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>'; // It worked.
else
echo 'There was an error during the file upload. Please try again.'; // It failed :(.

?>

That will allow you to upload to wherever you like, in this case "uploads"

To attach uploads to an email try following this (www.codewalkers.com), not the simplest example but you should be able to break it down
hueybot3000 (3646)
761482 2009-04-03 04:35:00 i modified the HTML - and PHP...
uploaded both , still not sending emails to me?...
Then talk to your hosting provider - if you uploaded the same thing that I put on my server for you, it means that the webserver is misconfigured. I have tested the version on my server and confirmed that it works.

I assume you remembered to change your address back to the correct one in your code?

Gotta say I can't help but think you'd be better off paying someone else to do this for you.
Erayd (23)
761483 2009-04-03 04:36:00 So do i have 2 PHP forms
I am planning on being restrictive with files able 2 be uploaded so will be removing some from that code....
csinclair83 (200)
761484 2009-04-03 04:37:00 OPPS! didnt change it...will retry!
guess being homealone with bubs and trying to do this at same time isnt a good idea haha
csinclair83 (200)
761485 2009-04-03 06:00:00 I'm really going nutty! Can one of you guys actually make the form that works - including upload and I'll just change it to show my address and the website address etc. As whatever I do, it just doesnt work and i'm going crazy...
I know the php works as I did a php email test...
and i've changed the email address to my one...
csinclair83 (200)
761486 2009-04-03 08:04:00 Copy the code below, past into notepad, save as phpinfo.php, upload to your server then navigate to this file in your browser, copy/paste results here or provide the link.


<?php
phpinfo();
?>
Rob99 (151)
761487 2009-04-03 08:52:00 Result a tad long for posting
but heres the link
oceansidegraphics.co.nz
csinclair83 (200)
761488 2009-04-03 09:23:00 Check your code, and make sure you have the correct files uploaded.
I could not find simplescript.php on your server.

Edit... I see you have it in your cgi-bin folder, make sure the path is correct on the form you are using.
Rob99 (151)
1 2 3 4