POST
form
posting
jQuery
<form class="form-horizontal" method="post" id="project_edit_form" enctype="multipart/form-data">
<div class="form-group">
<label for="title" class="control-label">Titel</label>
<input type="text" name="title" class="form-control" id="title" <?=(empty($data['title'])) ? 'placeholder="Titel"' : 'value="'.$data['title'].'"'?>>
</div>
<div class="form-group">
<label for="content" class="control-label">Beschrijving</label>
<textarea style="max-width:100%;" name="content" class="form-control" id="content" <?=(empty($data['content'])) ? 'placeholder="Beschrijving"' : ''?>><?=(empty($data['content'])) ? '' : $data['content']?></textarea>
</div>
<div class="form-group">
<label for="picture" class="control-label">Thumbnail</label>
<input type="file" name="picture" class="form-control" id="picture">
<img class="form-control" style="max-width:35%; height:auto;" src="images/projects/<?=(empty($data['picture'])) ? 'default.png' : $data['picture']?>">
<input type="submit" id="save_project" value="Opslaan" class="btn btn-lg btn-primary" style="float:right;">
</div>
</form>
函数的帮助,在我的处理程序中,我想获取我尝试上传的文件,但它说明了所有内容它没有索引的时间! :(
并不是说我没有得到任何东西,因为我得到了我在表格中的其他2个字段。
在表格中我有3个字段;
1.标题 - 文字
2.内容 - 文本
3.缩略图 - 文件上传
表格:
$("#project_edit_form").on("submit", function(e) {
e.preventDefault();
var form = $(this);
var url = "project_edit_handler.php";
var posting = $.post(url, form.serialize());
posting.done(function(data){
alert(data);
});
});
jQuery的:
<?php
echo $_POST['title']; //Work
echo $_POST['content']; //Work
echo $_POST['picture']; //Dont work
?>
处理程序:
var scale_x = d3.time.scale().range([0,width-40]).domain(d3.extent(nested, function(d){return d.key;})),
scale_y = d3.scale.linear().range([height-40,0]).domain([0,d3.max(nested, function(d){return d.values})]);
var xAxis = d3.svg.axis().scale(scale_x).orient("bottom").ticks(10),
yAxis = d3.svg.axis().scale(scale_y).orient("left").ticks(10);
var chartLine = d3.svg.line().interpolate("basis")
.x(function(d){return scale_x(d.key)})
.y(function(d){return scale_y(d.values)});
chart_container.append("g")
.attr("class","x axis")
.attr("transform", "translate(40,560)")
.call(xAxis)
chart_container.append("g")
.attr("class","y axis")
.attr("transform", "translate(40,0)")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text("frequency");