Jump to content

Recommended Posts

Hello all

i searched google for a simple contact form with one attachment option but i didnt find what i need.

 

Would you please give me some usefull links to download a simple code and test it?

 

I know how to make a php form and submit it, but never seen the attach code, i would see this code and understand it.

 

thanks 4 u all in advance

 

Link to comment
https://forums.phpfreaks.com/topic/97499-form-attach-code/
Share on other sites

Do you mean something likes this

<form method="post" enctype="multipart/form-data">
<p>Pictures:
<input type="file" name="pictures" />
<input type="text" name="Name" />
<input type="submit" value="Send" />
</p>
</form>

<?php
if(isset($_POST['submit']))
{
echo $_POST['Name'];
//Create a folder called upload with write access
$dir = dirname(__FILE__)."\upload";
        $tmp_name = $_FILES["pictures"]["tmp_name"];
        $name = $_FILES["pictures"]["name"];
        move_uploaded_file($tmp_name, "$dir/$name");
}
?>


Link to comment
https://forums.phpfreaks.com/topic/97499-form-attach-code/#findComment-498900
Share on other sites

Thank you eddierosenthal, i will check PHPmailer on google and see how does it work and test my code.

 

Thank you MadTechie, does this code only uploads pictures? or it takes any file type 'as I want'?

do i put this code in a php file and run it? sorry i am not professional, where do the site visitor writes his email address before submitting the form?

 

have a nice day

Link to comment
https://forums.phpfreaks.com/topic/97499-form-attach-code/#findComment-498916
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.