eleverson Posted November 25, 2013 Share Posted November 25, 2013 I have a Ultimate Web Hosting Linux account with Godaddy. I am using the pre-built webform godaddy provides which is the gdform.php. The form works the only problem I wanted to add a file upload and this form does not support it. I need help making a customize form. I have tried to add to the form and still not receiving the file. html code <form action="/gdform.php" method="post"> <h1>Your Information</h1><input type="hidden" name="subject" value="Form Submission"<input type="hidden" name="redirect" value="thankyou.html" /><a href="https://cid-31240a340806bd09.calendar.live.com/calendar/private/65823f73-7ada-4c07-ad10-7f2023657d03/392aa04c-6892-452d-986b-b5cd70bed1a7/index.html" target="_blank" >View Appointment Calendar</a><br> <img src="kelly3.jpg" alt="lace front wig" class="kelly3"><p>First Name <input type="text" name="first_name" size="40" maxlength="35" /></br</p><p>Last Name <input type="text" name="last_name" size="40" maxlength="35" /></br></p><p>Email <input type="email" name="email" size="40" maxlength="35" required /></br></p><p>Telephone<input type="tel" name="tel" size="40" maxlength="35"/></br></p><p>Please provide information on the hair services you are interested in.</p> <textarea name="info" cols="40" rows="10"></textarea><br> <form enctype="multipart/form-data"><p>Please upload your hair style photos</p><input type="file" name="file" accept="image/jpg,image/gif,image/png"><input type="submit" name="submit" value="submit" style="background-color: #f00;font-size:24px; margin-top: 60px; margin-left: 415px; "/> </form></form> php code <?php $request_method = $_SERVER["REQUEST_METHOD"]; if($request_method == "GET"){ $query_vars = $_GET; } elseif ($request_method == "POST"){ $query_vars = $_POST; } reset($query_vars); $t = date("U"); $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t; $fp = fopen($file,"w"); while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n"); fputs($fp,"$val\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n"); if ($key == "redirect") { $landing_page = $val;} } fclose($fp); $allowedExts = array("gif", "jpeg", "jpg", "png");$temp = explode(".", $_FILES["file"]["name"]);$extension = end($temp);if ((($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")|| ($_FILES["file"]["type"] == "image/jpg")|| ($_FILES["file"]["type"] == "image/pjpeg")|| ($_FILES["file"]["type"] == "image/x-png")|| ($_FILES["file"]["type"] == "image/png"))&& ($_FILES["file"]["size"] < 20000)&& in_array($extension, $allowedExts)) if ($landing_page != "thankyou.html"){ header("Location:thankyou.html"); } else { header("Location: http://".$_SERVER["HTTP_HOST"]."thankyou.html"); }?> I receive an email with just a name of the attachment. If you guy's can give me a whole another php code that could work it would be appreciated. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 26, 2013 Share Posted November 26, 2013 (edited) Your form code should be <form action="/gdform.php" method="post" enctype="multipart/form-data"> <h1>Your Information</h1> <input type="hidden" name="subject" value="Form Submission" /> <input type="hidden" name="redirect" value="thankyou.html" /> <a href="https://cid-31240a34...d1a7/index.html" target="_blank" >View Appointment Calendar</a><br> <img src="kelly3.jpg" alt="lace front wig" class="kelly3"> <p>First Name <input type="text" name="first_name" size="40" maxlength="35" /></br</p> <p>Last Name <input type="text" name="last_name" size="40" maxlength="35" /></br></p> <p>Email <input type="email" name="email" size="40" maxlength="35" required /></br></p> <p>Telephone<input type="tel" name="tel" size="40" maxlength="35"/></br></p> <p>Please provide information on the hair services you are interested in.</p> <textarea name="info" cols="40" rows="10"> </textarea><br> <p>Please upload your hair style photos</p><input type="file" name="file" accept="image/jpg,image/gif,image/png"> <input type="submit" name="submit" value="submit" style="background-color: #f00;font-size:24px; margin-top: 60px; margin-left: 415px; "/> </form> Edited November 26, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
eleverson Posted November 26, 2013 Author Share Posted November 26, 2013 putting it in all one form does not make a difference. I did all that in the past. The problem is...it will not send the file as a attachment in my email. I need a NEW PHP CODE WRITTEN. Anyone have suggestions? Quote Link to comment Share on other sites More sharing options...
eleverson Posted November 26, 2013 Author Share Posted November 26, 2013 I also tried to use this php code on my website and it didn't send me all the info <?php $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email = $_POST['email']; $tel = $_POST['tel']; $info = $_POST['info']; $file = $_Files['files']; $file_name = $file['name']; $file_size = $file['size']; $file_tmp_location =$file['tmp_name']; $file_type = $file['type']; $to = "info@changingfacesbeautysalon.net"; $subject ="Salon Client"; mail($to, $subject,$info,$email,$tel,$file "From:" . $first_name . $last_name); header('Location:thankyou.html'); ?> I might be missing something Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.