form文件上传,防止页面刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>文件上传form提交</title>
</head>
<body>
<form id="form" method="post" enctype="multipart/form-data" target="iframe" action="upload.php">
<p>Upload File: <input type="file" name="Filedata" /></p>
<p><input type="submit" value="Submit" id="submit"/></p>
</form>
<iframe name="iframe" style="display:none;" id="iframe" ><p></p></iframe>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("#submit").click(function(){
$("#form").submit();
});
var iframe = document.getElementById('iframe');
var repose="";
if(iframe.attachEvent){//ie
iframe.attachEvent("onload", function(){
var win1 = document.getElementById('iframe').contentWindow;
repose= win1.document.body.innerHTML ;
repose=eval('(' + repose + ')');
$("#form").append("<div><img src='"+repose.data.img+"'/></div>");
});
}else{//chrome,ff
iframe.onload = function(){
var win2 = document.getElementById('iframe').contentWindow;
repose= win2.document.body.innerHTML ;
repose=eval('(' + repose + ')');
$("#form").append("<div><img src='"+repose.data.img+"'/></div>");
};
}
});
</script>
</body>
</html>
form文件上传,防止页面刷新的更多相关文章
- Day21 Django之Form文件上传、原生Ajax和实现抽屉实例
一.Form文件上传 """ Django settings for prev_chouti project. Generated by 'django-admin st ...
- from表单文件上传后页面跳转解决办法
from表单上传文件,路径跳转后,又不能转发回来. 本人的一个解决办法是.返回一段html代码,浏览器解析后后退一步,回到原来的页面并刷新. return "<html>< ...
- Form -- 文件上传
当我们选中文件,点击上传时即可. 而此按钮一般是一张图片覆盖了一个input标签而以.基于这个原理我们可以定制自己喜欢的样式 <div style="text-align: cente ...
- ASP.NET CORE RAZOR :将文件上传至 ASP.NET Core 中的 Razor 页面
本部分演示使用 Razor 页面上传文件. 本教程中的 Razor 页面 Movie 示例应用使用简单的模型绑定上传文件,非常适合上传小型文件. 有关流式传输大文件的信息,请参阅通过流式传输上传大文件 ...
- form里面文件上传并预览
其实form里面是不能嵌套form的,如果form里面有图片上传和其他input框,我们希望上传图片并预览图片,然后将其他input框填写完毕,再提交整个表单的话,有两种方式! 方式一:点击上传按钮的 ...
- Struts文件上传机制
1首先建立文件上传jsp页面如下 <form action="" method="post" enctype="multipart/form-d ...
- SpringMVC文件上传下载(单文件、多文件)
前言 大家好,我是bigsai,今天我们学习Springmvc的文件上传下载. 文件上传和下载是互联网web应用非常重要的组成部分,它是信息交互传输的重要渠道之一.你可能经常在网页上传下载文件,你可能 ...
- jQuery文件上传插件jQuery Upload File 有上传进度条
jQuery文件上传插件jQuery Upload File 有上传进度条 jQuery文件上传插件jQuery Upload File,插件使用简单,支持单文件和多文件上传,支持文件拖拽上传,有进度 ...
- Struts2之文件上传下载
本篇文章主要介绍如何利用struts2进行文件的上传及下载,同时给出我在编写同时所遇到的一些问题的解决方案. 文件上传 前端页面 <!-- 引入struts标签 --> <%@tag ...
随机推荐
- HDFS中高可用性HA的讲解
HDFS Using QJM HA使用的是分布式的日志管理方式 一:概述 1.背景 如果namenode出现问题,整个HDFS集群将不能使用. 是不是可以有两个namenode呢 一个为对外服务-&g ...
- There is no tracking information for the current branch
There is no tracking information for the current branch. Please specify which branch you want to mer ...
- BAT(批处理)获得参数
原文转自:http://blog.csdn.net/luhouxiang/article/details/31733049 获取参数有2种, 一种为从命令行输入参数,使用两个%中间包含数字表示,数字从 ...
- fprintf与fwrite函数用法与差异
在C语言中有两个常见的保存文件的函数:fprintf 与 fwrite.其主要用法与差异归纳如下: 一.fprintf函数. 1.以文本的形式保存文件.函数原型为 int fprintf(FILE* ...
- NDK编译FreeImage
参考了 以下2篇文章 并作了一小点修改 http://recursify.com/blog/2013/05/25/building-freeimage-for-android http://blog. ...
- Selenium2学习-021-WebUI自动化实战实例-019-设置浏览器窗口位置大小
前文简略讲述了如何获取浏览器窗口的位置和大小,此文讲述如何通过 webdriver 设置浏览器窗口的位置和大小. 直接上码了...... /** * Set browser size for expe ...
- C#类的继承
public class Animal { public string word=""; //virtual表示虚方法,用以被重写 public virtual void say( ...
- linux压缩解压
zip压缩文件 zip -r filename.zip filesdir zip -r filename.zip file1 file2 file3 /usr/work/school //将file1 ...
- 将一个UIView对象的内容保存为UIImage
+ (UIImage*)imageFromView:(UIView*)view{ UIGraphicsBeginImageContextWithOptions(view.bounds.size, YE ...
- Insert BLOB && CLOB from PL/SQL and JDBC
For PL/SQL 1)Create Directory Where BLOB resides. create or replace directory temp as '/oradata2'; - ...