随笔 - 7  文章 - 3  trackbacks - 0
<2013年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用链接

留言簿

随笔档案

文章分类

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

     摘要: 首先我们需要一个被加载的js文件,我在一个固定文件夹下创建了一个package.js,打开后在里面写一个方法functionOne,很简单,代码如下:function functionOne(){ alert("成功加载"); }后面的html文件都创建在同一个目录下。方法一:直接document.write在同一个文件夹下面创建一个function1.html,代码如下:<ht...  阅读全文
posted @ 2013-06-01 09:19 Tomas 阅读(379) | 评论 (0)编辑 收藏


多文件上传 jquery的插件
使用的方法  导入 jquery.js 及 jquery.MultiFile.js ,
方式一: 后台是文件数组  
 private File[] upload; // 与jsp表单中的名称对应
 private String[] uploadFileName;
 private String[] uploadContentType;
在 form 中加入 <input type="file" name="upload[]" class="multi" /> 即可。

方式二:后台是List<File>
 private List<File> upload; // 与jsp表单中的名称对应
 private List<String> uploadFileName;
 private List<String> uploadContentType;

jquery.MultiFile.js  将选中的文件列在From中,名字为upload的<input>,所以要用 name="upload[]"(方法一)或者name="upload" (方法二) 来接收
class="multi" 是 jQuery 用来作的文件类型,HTML 部份代码如下:

<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Untitled Document</title>
<script src="/multiple-file-upload/jquery.js" type="text/javascript" language="javascript"></script>
<script src="/multiple-file-upload/jquery.MultiFile.js" type="text/javascript" language="javascript"></script>

</head>
<body>

<form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
<input type="file" name="upload[]" class="multi" maxlength="2"/>
//<input type="file" name="upload" class="multi" />

<input type="submit" value="Upload File" />
</form>

</body>

参数说明:

参数 说明 说明
class="multi" maxlength="2" Limit: 2 files.
Allowed extensions: any.
限制数量2
class="multi" accept="gif|jpg" Limit: no limit.
Allowed extensions: gif and jpg.
格式只能 gif  jpg
class="multi" accept="gif|jpg" maxlength="3" Limit: 3 files
Allowed extensions: gif, jpg.
限制数量3,格式只能 gif  jpg


主页:http://www.fyneworks.com/jquery/multiple-file-upload/

下载:http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Download

示例:http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Examples

posted @ 2013-05-17 15:56 Tomas 阅读(4154) | 评论 (2)编辑 收藏