Php 如果宽度为,如何删除文件!=829像素和高度!=90像素
如何从输入中删除文件type=“file”if width!=829像素和高度!=90像素 我使用Php 如果宽度为,如何删除文件!=829像素和高度!=90像素,php,jquery,Php,Jquery,如何从输入中删除文件type=“file”if width!=829像素和高度!=90像素 我使用this.value=“但不工作,怎么办 <script type="text/javascript"> var _URL = window.URL || window.webkitURL; $("#image_1").change(function(e) { var image_1, img; if ((image_1 = this.fi
this.value=“
但不工作,怎么办
<script type="text/javascript">
var _URL = window.URL || window.webkitURL;
$("#image_1").change(function(e) {
var image_1, img;
if ((image_1 = this.files[0])) {
img = new Image();
img.onload = function() {
if ((this.width != '728') && (this.height != '90'))
{
alert("not width 728 px and height 90 px.");
this.value=""
}
};
img.src = _URL.createObjectURL(image_1);
}
});
</script>
var URL=window.URL | | window.webkitURL;
$(“#图像_1”)。更改(功能(e){
var图像_1,img;
如果((image_1=this.files[0])){
img=新图像();
img.onload=函数(){
如果((this.width!=“728”)&&(this.height!=“90”))
{
警报(“不是宽度728像素,高度90像素”);
this.value=“”
}
};
img.src=\u URL.createObjectURL(图1);
}
});
使用以下解决方案:
函数resetFormElement(e){
e、 换行(“”).closest('form').get(0.reset();
e、 展开();
}
var URL=window.URL | | window.webkitURL;
$(“#图像_1”)。更改(功能(e){
var图像_1,img;
如果((image_1=this.files[0])){
img=新图像();
img.onload=函数(){
如果((this.width!=“728”)&&(this.height!=“90”))
{
警报(“不是宽度728像素,高度90像素”);
resetFormElement($(this));
}
};
img.src=\u URL.createObjectURL(图1);
}
});
function resetFormElement(e) {
e.wrap('<form>').closest('form').get(0).reset();
e.unwrap();
}
var _URL = window.URL || window.webkitURL;
$("#image_1").change(function(e) {
var image_1, img;
if ((image_1 = this.files[0])) {
img = new Image();
img.onload = function() {
if ((this.width != '728') && (this.height != '90'))
{
alert("not width 728 px and height 90 px.");
resetFormElement($(this));
}
};
img.src = _URL.createObjectURL(image_1);
}
});