我有一个包含文件输入、上传按钮和取消按钮的表单:
<form action='imageupload.php' method='post'
enctype='multipart/form-data' target='upload_target'
onsubmit='stopImageUpload(this);' class='imageuploadform' >
<p class='imagef1_upload_form' align='center'>
<label>Image File:
<input name='fileImage' type='file' class='fileImage' />
</label>
<input type='submit' name='submitImageBtn' class='sbtnimage' value='Upload' />
</label>
</p>
<p class='imagef1_cancel' align='center'>
<label>
<input type='button' name='imageCancel' class='imageCancel' value='Cancel' />
</label>
</p>
<iframe class='upload_target' name='upload_target' src='#' style='width:0;height:0;border:0px;solid;#fff;'>
</iframe>
</form>
我想知道的是,当用户点击取消按钮时,如何取消文件上传?
最佳答案
我认为更改目标 iframe“src”属性或内容会中止上传。
$(".imageCancel").click(function() {
$(".upload_target").attr("src","#");
});
关于javascript - 单击按钮时如何取消文件上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10162327/