html5预览本地图片后php上传服务器
代码如下
<input type="file" class="picinput" onchange="readfile(this);" />
function readfile(source){
var $len=$('.showsmallpic').length;
if ($len>=4){
alert("最多添加4张张片~~")
}
else{
var file = source.files[0];
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function(e){
document.getElementById('showpic').style.backgroundImage="url("+this.result+");"//预览大图
$('<div class="smallpicbox"><div class="showsmallpic" onclick="showbigpic(this)"; style="background-image:url('+this.result+')"></div><div class="delpic" onclick="delpic(this)">x</div></div>').appendTo($("#showsmallpic"));
//在一个div内添加预览图片的缩略图
}}
}
php刚入门 想实现预览本地图片 确认后上传到服务器 一个input上传图片的php代码我会 但不知道一个input实现多张图片预览然后上传php服务器的代码该怎么写 不用给出详细的代码 给点思路和方向就行 我可以自己琢磨 谢谢~!