先要下载压缩包

www.uploadify.com/wp-content/uploads/files/uploadify.zip

1,模板文件引用

<!--引用jquery uploady*}-->
<script src="http://www.96net.com.cn/public/jquery.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="http://www.96net.com.cn/public/uploadify.css" media="all">
<script type="text/javascript" src="http://www.96net.com.cn/public/jquery.uploadify.min.js"></script>
<!-- uploadify相关设置 -->
<script type="text/javascript">
$(function() {
$('#file_upload').uploadify({
'formData' : {
'timestamp' : '{#$timestamp#}',
'token' : '{#$token#}'
},
//在php下应用的时候请务必加上这些代码,避免使用出错
'buttonText':'上传',
'multi': true,//允许多文件上传
'swf' : "public/uploadify.swf",
'uploader' : '{#spUrl c=heji a=uploadify#}',
'onUploadSuccess': function (file, data, response) {
$('.touxiang_path').val(data);
}
});
});
</script>

2.代码添加几行代码

<div class="touxiang">
<input id="file_upload" type="text" name="touxiang">
</div>

<div class="touxiang_path">
<input id="" type="text" name="touxiang_path" class="touxiang_path" style="width: 500px;">
</div>

可以任意修改样式,可以更加美观

3,php上传处理

$targetFolder = '/up/';

$verifyToken = md5('unique_salt' . $_POST['timestamp']);

if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $handler_dir.'/'. $targetFolder;
$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];

$fileTypes = array('jpg','jpeg','gif','png'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);

if (in_array($fileParts['extension'],$fileTypes)) {
move_uploaded_file($tempFile,$targetFile);
echo '1';
} else {
echo 'Invalid file type.';
}
}

可以设置图片和文件大小,可以加水印,缩略图,任意处理图片等

uploadify多图片和文件上传网站应用的更多相关文章

  1. 基于uploadify.js实现多文件上传和上传进度条的显示

    uploadify是JQuery的一个插件,主要实现文件的异步上传功能,可以自定义文件大小限制.文件类型.是否自动上传等属性,可以显示上传的进度条.官网地址是http://www.uploadify. ...

  2. UEditor独立图片、文件上传模块

    百度的UEditor编辑器的强大之处不用多说,但是有时候我们只想用他的文件.图片上传模块,不想把这个编辑器加载出来,话不多说,直接上实现代码: 引用文件: <script src="~ ...

  3. AFNetworking之多图片-文件上传

    在分享经验之前,先说点题外话,之前的一个项目涉及到了多图片的上传,本来以为是一个很简单的事情,却着实困扰了我好久,究其原因,一是我不够细心,二是与后台人员的交流不够充分.在此,我想将我的老师常说的一句 ...

  4. 在 .NET Core项目中使用UEditor图片、文件上传服务

    在.NET Framework中使用UEditor时,只需要将UEditor提供的后端服务,部署为一个子程序,即可直接使用文件上传相关的服务,但是UEditor官方并未提供.Net Core的项目,并 ...

  5. 一款基于uploadify扩展的多文件上传插件,完全适用于Html5

    http://www.uploadify.com/documentation/  官网里面有两个插件,一个是要使用flash插件才能文件上传的插件,另外一个是不需要使用要flash插件的文件上传插件完 ...

  6. vue+Ueditor集成 [前后端分离项目][图片、文件上传][富文本编辑]

    后端DEMO:https://github.com/coderliguoqing/UeditorSpringboot 前端DEMO:https://github.com/coderliguoqing/ ...

  7. 6.12号整理(h5新特性-图片、文件上传)

    <input type="file" id='myFile' multiple> <ul> <li> <img src="&qu ...

  8. java springmvc4 图片或文件上传

    1.文件配置 配置文件解析 上传文件处理的核心方法 // uploadOneFile.jsp, uploadMultiFile.jsp submit to. @RequestMapping(value ...

  9. jQuery uploadify 文件上传

    uploadify这个插件是基于js里面的jquery库写的.结合了ajax和flash,实现了这个多线程上传的功能.现在最新版为3.2.1. 在线实例 实例预览 Uploadify 在线实例Demo ...

随机推荐

  1. Vue build打包之后,刷新页面出现404解决方案

    Vue build打包之后,刷新页面出现404,HTML5 History 模式 原因分析: vue-router 默认 hash 模式 —— 使用 URL 的 hash 来模拟一个完整的 URL,于 ...

  2. 08Servlet

    1.Servlet概念 1.1 servlet的特点 1)sevlet是一个普通的java类,继承HttpServlet类. 2)其实实现了Servlet接口的java类,才是一个Servlet类. ...

  3. 【LeetCode】前缀树 trie(共14题)

    [208]Implement Trie (Prefix Tree) (2018年11月27日) 实现基本的 trie 树,包括 insert, search, startWith 操作等 api. 题 ...

  4. 将postgresql中的数据实时同步到kafka中

    参考地址:https://blog.csdn.net/weixin_33985507/article/details/92460419 参考地址:https://mp.weixin.qq.com/s/ ...

  5. C++ decltype

    #include <iostream> using namespace std; int main() { int ia{3}; decltype(ia) varr[3]={1,2,3}; ...

  6. TCP TIME_WAIT和CLOSE_WAIT

    原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11484451.html 使用如下指令查看当前Server的TCP状态 netstat -n | awk ...

  7. Java+Maven的工程运行Sonar的方式

    step 1:在maven->setting.xml中进行配置 修改mvn工程所用的setting.xml文件,在<profiles></profiles>节点中增加: ...

  8. [洛谷P3486]POI2009 KON-Ticket Inspector

    问题描述 Byteasar works as a ticket inspector in a Byteotian National Railways (BNR) express train that ...

  9. deque的简单使用

    depue 是python提供的一个数据结构,线程安全,功能比list强大 from collections import deque user_list = ['admin', 'root'] us ...

  10. springboot2整合logback.xml动态修改日志打印级别

    今天找bug烦到了,生产上的日志级别不能修改,非常不利于排查问题,于是想到了动态修改日志打印级别, 因为上一周把项目升级成springboot2,并且使用logback.xml管理日志打印,所以修改也 ...