原帖由 devilbat 于 2009-9-26 01:42 PM 发表
我目前参考和研究做了一个form
目标是发送去gmail
目前所有验证和发送内容都成功送达
只有upload图片的这个功能不管怎么写都不会有效果
邮件当中就只有其他内容,就是这个上传的图片不会显示
而且上传的图 ...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SimpleForm Example</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="simpleform.css" type="text/css" media="screen"/>
<script type="text/javascript" src="checkform.mini.js"></script>
</head>
<body>
<?php
define('CONFIG_PATH', '');
require_once "simpleform.php";
$sForm = new simpleForm();
$sForm->handleMessage();
?>
<form action="simpleform.php" method="post" onsubmit="return checkform(this)" enctype="multipart/form-data">
<fieldset>
<?php $sForm->printData(1); ?>
<legend>Personal Information:</legend>
<label for="name" >Name<span class="required">(required)</span></label>
<input name="name" id="name" type="text" value="" />
<label for="nickname" >Nickname<span class="required">(required)</span></label>
<input name="nickname" id="nickname" type="text" value="" />
<label for="age" >Your Age<span class="required">(required)</span></label>
<input name="age" id="age" type="text" value="" />
<label for="ic" >IC/Passport Number<span class="required">(required)</span></label>
<input name="ic" id="ic" type="text" value="" />
<label for="adds" >Address</label>
<input name="adds" id="adds" type="text" value="" />
<label for="color">Race :</label>
<select name="race" id="race">
<option value="-">Choose your race...</option>
<option value="Chinese">Chinese</option>
<option value="Melay">Melay</option>
<option value="India">India</option>
<option value="Others/foreigner">Others/foreigner</option>
</select>
<label for="email">Email <span class="required">(required)</span></label>
<input name="email" id="email" type="text" value="" />
<label for="phone">Telephone <span class="required">(required)</span></label>
<input name="phone" id="phone" type="text" value="" />
</fieldset>
<fieldset>
<legend>Figure Information</legend>
<label for="bwh">BWH (Fill as: B/W/H) <span class="required">(required)</span></label>
<input name="bwh" id="bwh" type="text" value="" />
<label for="weight">Weight(kg)<span class="required">(required)</span></label>
<input name="weight" id="weight" type="text" value="" />
<label for="height">Height(cm)<span class="required">(required)</span></label>
<input name="height" id="height" type="text" value="" />
<label for="shoes">Shoes Size'<span class="required">(required)</span></label>
<input name="shoes" id="shoes" type="text" value="" />
</fieldset>
<fieldset>
<legend>Extra Information</legend>
<label for="langu">Language(Speaking/Writing/Reading)</label>
<input name="langu" id="langu" type="text" value="" />
<label for="wex">Working Experiences</label>
<input name="wex" id="wex" type="text" value="" />
<label for="prof">Profesional in (Example: sales, model...)</label>
<input name="prof" id="prof" type="text" value="" />
</fieldset>
<fieldset>
<legend>Submit Your Pictures(Without Editing by any photo softwares.)<span class="required">(required)</span></legend>
<label for="image">Picture1</label>
<input type="file" name="image" value="" />
</fieldset>
<p><button type="submit" value="Upload image">Submit this!</button></p>
</form>
</body>
</html>
原帖由 宅男-兜着走 于 2009-9-26 07:21 PM 发表
正常来讲的话就include hosting 给的PHP mailer 就gao dim 了啊 什么都不必写。
自己打开Hosting 的manual 来读读看吧。
原帖由 devilbat 于 2009-9-26 09:22 PM 发表
这个是simpeform.php的内容
private function declareHeaders()
{
$this->szHeaders = 'From: ' . $this->aSettings['szFromEmail'] . "\r\n";
$this->szHeaders .= 'Reply-To: ' .$this->aSettings['szFromEmail'] . "\r\n" . 'X-Mailer: PHP/' .phpversion();
}
原帖由 devilbat 于 2009-9-27 04:28 PM 发表
实验后还在找寻答案。。。所以先用php.com那里看到的基本的东西做了另外一个
希望大家帮我看看这个东西的几个问题:
第一个就是:该加什么才可以指定上传的图片是随机名字的呢?
第二个就是:我的图片如果 ...
原帖由 Super-Tomato 于 2009-9-27 07:52 PM 发表
你這只是在寫上傳而不是附件, 而上傳的部份圖片要如何更改檔名就需要在這里下手
$uploadfile = $uploaddir . basename($_FILES['userfile']['name'][$i]);
只是把信件内容使用 html 的話,请注意你 ...
原帖由 devilbat 于 2009-9-28 09:58 AM 发表
昨天试验用了$randFilename = uniqid("img_");
来加随机名字~成功了
谢谢你的帮助!
对了,不知道大家知道怎么js验证多个吗?
好奇想知道
因为昨天在google reserch很久。。大多数的资料都没有个所以来 ...
<html>
<head>
<title>Super-Tomato Input verification</title>
<script type="text/javascript">
function verify()
{
var uploadfile = document.getElementsByName("filename[]");
var uploadnum = 0;
for(var x=0; x<uploadfile.length; x++)
{
if(uploadfile[x].value != "")
{
uploadnum++;
alert("File " + (x+1) + " : " + uploadfile[x].value);
}
}
if(uploadnum)
return true;
else
{
alert("No upload file.");
return false;
}
}
</script>
<body>
<form action="" method="post" onSubmit="return verify()" >
File 1 : <input type="file" name="filename[]" /><br />
File 2 : <input type="file" name="filename[]" /><br />
<input type="submit" value="Submit" />
</form>
</body>
</html>
原帖由 devilbat 于 2009-9-28 12:11 PM 发表
hmm....不是很了。。。。研究下
那个
if(uploadfile[x].value != "")
{
uploadnum++;
alert("File " + (x+1) + " : " + uploadfile[x].value);
...
欢迎光临 JBTALKS.CC (https://jbtalks.my/) | Powered by Discuz! X2.5 |