我想将文件上载到投入类型档案中,但当我把表格编成分类时,我只拿到了投入类型文本,而其他人则不是档案——我如何这样做? 难道这种 j笑没有实现吗?
The html/php:
<form action="<?php echo HTTP_ROOT.INC_LAYOUT;?>ask_add_xml.php" method="post" enctype="multipart/form-data" id="form_qna_ask">
<div class="item-form">
<h2><a href="#"><span>ASK</span></a></h2>
<label id="ask_title_label">
<input type="text" name="ask_title" id="ask_title" value="" title="TYPE IN A TITLE"/>
</label>
</div>
<div class="item-form">
<h2><a href="#"><span>EMAIL</span></a></h2>
<label id="ask_email_label">
<input type="text" name="ask_email" id="ask_email" value="" title="TYPE IN YOUR EMAIL"/>
</label>
</div>
<div class="item-form">
<label id="ask_content_label">
<textarea name="ask_content" id="content_mce" title="CONTENT"></textarea>
</label>
</div>
<div class="item-form">
<div class="left">
<label>
<img src="views/www/styles/images/global/button-add-images-q-n-a.gif" alt="add images" style="float:left;"/>
<h2 id="add_images_label"><a href="#"><span>Add Images</span></a></h2>
</label>
</div>
<div class="right">
<div class="processing"></div>
<input type="submit" name="cancel" value="CANCEL"/>
<input type="submit" name="submit" value="SUBMIT"/>
</div>
</div>
<div class="item-form" style="border:1px solid #bbbbbb; padding:10px 10px 20px 15px; background-color:#ffffff;">
<p>Add images: this allows you to attach pictures to your question. Only 2 pictures at 2MB each are allowed to upload.</p>
<input type="file" name="image[]"/>
<input type="file" name="image[]" />
</div>
</form>
这是 j,
this.postForm_ask = function(){
$("#form_qna_ask").submit(function(){
$( #popup_result ).remove();
var path = $(this).attr( action );
var processing = $( #q-n-a .processing );
processing
.css({
margin:"0px 0px 0px -80px",
position:"absolute",
visibility:"visible"
});
processing.html( <div><p><img src=" +http_root+img_global+ loader-2b.gif"/> loading</p></div> );
$.post(path, $("#form_qna_ask").serialize(),function(xml){
alert($("#form_qna_ask").serialize());
processing
.css({
visibility:"hidden"
});
processAsk(xml);
});
return false;
});
}
many thanks, Lau