php - I am getting notice undefined index but the index is there -
i keep getting notice:undefined index: upfile in /home/hostnile/public_html/v2/ar/includes/content/career.php on line 93
this in line 93 $mycv = $_files['upfile']['name'];
<div class="cointainer"> <label for="upfile" class="f_right width_165">upload file</label> <input type="file" name="upfile" id="upfile" class="f_right" style="direction:rtl;"/> </div>
what doing wrong here? how solve this?
edit
the html full code
<div class="bgpages"> <div class="contentpages"> <div class="width_818 career"> <div class="header"><span>يشرفنا دائما أن ينضم إلى فريق عملنا باحثون جدد عن الأفضل</span></div> <form id="apply career" method="post" action="<?php $_server['php_self']; ?>"> <div class="body"> <?php //handling message2 if ($msg == "done") { echo "<div class='fontgreen'> نشكرك علي حرصك الانضمام لفريق عملنا</div>"; } elseif ($msg == "fail") { echo "<div class='fontred'> لم تصل رسالتك برجاء المحاولة مرة اخري</div>"; } ?> <div class="cointainer margin_16px"> <label for="yourname" class="f_right width_165">الاسم</label> <input name="yourname" id="yourname" type="text" class="form_textarea_rec"/> </div> <div class="cointainer"> <label for="youremail" class="f_right width_165"> بريدك الالكتروني</label> <input type="text" name="youremail" id="youremail" class="form_textarea_rec"/> </div> <div class="cointainer"> <label for="yourjob" class="f_right width_165">الوظيفة</label> <input type="text" name="yourjob" id="yourjob" class="form_textarea_rec"/> </div> <div class="cointainer"> <label for="yourtele" class="f_right width_165">رقم التليفون</label> <input type="text" name="yourtele" id="yourtele" class="form_textarea_rec"/> </div> <div class="cointainer"> <label for="upfile" class="f_right width_165">تحميل السيرة الذاتية </label> <input type="file" name="upfile" id="upfile" class="f_right" style="direction:rtl;"/> </div> <div class="f_right m_top_10px"> <p class="f_right width_165">أدخل كود التحقق</p> <input class="form_textarea_cap f_right" type="text" name="captcha" id="captcha"> <img src="includes/content/captcha.php" style="margin-top: 3px; height: 30px; float: right"/> <?php //handling message1 if ($msg == "ec") { echo "<img src='../images/error.png' width='34' height='34' alt='' class='margin_8r f_right'/>"; } ?> </div> </div> <div class="footer"><input type="submit" value="ارسل" class="s_btn" name="submit" id="submit"/> </div> </form> </div> </div> </div>
and full php code
<?php /** * created phpstorm. * user: yousef * date: 6/15/14 * time: 3:29 pm */ error_reporting(e_all | e_strict); if (isset($_post['submit'])) { session_start(); $yourname = $_post['yourname']; $youremail = $_post['youremail']; $yourjob = $_post['yourjob']; $yourtele = $_post['yourtele']; $mycv = $_files['upfile']['name']; $captcha = $_post['captcha']; if (isset($_post["captcha"]) && $_post["captcha"] != "" && $_session["code"] == $_post["captcha"]) { $strto = 'johnef_sh@hotmail.com'; $strsubject = "someone apply career"; $strmessage = nl2br("this information apply new career\r\n position applied for:" . $yourjob . ",\r\n name is: " . $yourname . ",\r\n phone number: " . $yourtele . ",\r\n email: " . $youremail . " \r\n"); //*** uniqid session ***// $strsid = md5(uniqid(time())); $strheader = ""; $strheader .= "from:johnef_sh@hotmail.com\r\nreply-to:johnef_sh@hotmail.com"; $strheader .= "mime-version: 1.0\n"; $strheader .= "content-type: multipart/mixed; boundary=\"" . $strsid . "\"\n\n"; $strheader .= "this multi-part message in mime format.\n"; $strheader .= "--" . $strsid . "\n"; $strheader .= "content-type: text/html; charset=utf-8\n"; $strheader .= "content-transfer-encoding: 7bit\n\n"; $strheader .= $strmessage . "\n\n"; //*** attachment ***// if ($_files['upfile']['name'] != "") { $strfilesname = $_files["upfile"]["name"]; $strcontent = chunk_split(base64_encode(file_get_contents($_files["upfile"]["tmp_name"]))); $strheader .= "--" . $strsid . "\n"; $strheader .= "content-type: application/octet-stream; name=\"" . $strfilesname . "\"\n"; $strheader .= "content-transfer-encoding: base64\n"; $strheader .= "content-disposition: attachment; filename=\"" . $strfilesname . "\"\n\n"; $strheader .= $strcontent . "\n\n"; } $flgsend = @mail($strto, $strsubject, null, $strheader); // @ = no show error // if ($flgsend) { header("location:?pid=11&msg=done"); } else { //header('location:?pid=11&msg=fail'); } } else { header("location:?pid=11&msg=ec"); } } ?>
you have missed enctype="multipart/form-data"
. add form -
<form id="apply career" method="post" action="<?php $_server['php_self']; ?>" enctype="multipart/form-data">
Comments
Post a Comment