700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > thinkPHP+uploadify 实现图片上传预览

thinkPHP+uploadify 实现图片上传预览

时间:2021-03-20 22:57:40

相关推荐

thinkPHP+uploadify 实现图片上传预览

php教程|php手册

thinkphp代码,代码示例,代码参考,php短信,数据库备份代码,令牌验证,去除代码中的空白和注释

php教程-php手册

thinkPHP+uploadify 实现图片上传预览 ,小弟新手,做的不足的地方望指教!

效果图

模板文件:

播客视频网源码,vscode清理缓存,ubuntu自动挂载硬盘方法,403 tomcat问题,sqlite存储浮点型,上传图片固定裁剪插件,前后台分离前端框架,谷歌爬虫限制多久,php反斜杠,reactjs seo,手游应用网站源码解版,html网页等比例缩放,帝国后台模板无法修改,wordpress 网站首页可以打开其他页面打不开,推荐文章管理系统,php的seo程序源码lzw

业务配置系统源码,ubuntu 查看进程树,爬虫饲养箱消毒,php+7+与php5,seo课程破解lzw

#image{

height:300px;

width:720px;

border:1px #969594 solid;

}

图片上传

书籍网站源码,vscode禁用自动格式化,ubuntu黑色壁纸,手工部署tomcat,如果爬虫图片,php版本控制工具,竞价网站和seo网站的区别,copy php网站lzw

$(document).ready(function () {

$("#uploadify").uploadify({

uploader:/Public/jquery.uploadify-v2.1.0/uploadify.swf, //swf路径

script: /Code/file,//后台处理文件上传的路径

cancelImg:/Public/jquery.uploadify-v2.1.0/cancel.jpg,//按钮背景图片的路径

folder: /Uploads,

method:post,

uttonText:file,

fileExt: *.jpg;*.jpg,*.jpg, //允许上传的文件格式为*.jpg,*.jpg,*.jpg

fileDesc: Web Image Files(.JPG,.GIF,.PNG), //过滤掉除了*.jpg,*.jpg,*.jpg的文件

queueID: fileQueue,

sizeLimit: 2048000, //最大允许的文件大小为2M

fileDataName:uploadify,

auto: false,

queueSizeLimit:15,

simUploadLimit:15,

emoveCompleted:false,

multi:true,

onCancel: funCancel,//当用户取消上传时

onComplete: funComplete,//完成上传任务

OnError: funError //上传发生错误时

});

});

//用户取消函数

function funCancel(event, ID, fileObj, data) {

alert(您取消了操作);

return;

}

//图片上传发生的事件

function funComplete(event, ID, fileObj, response, data) {

//alert(上传事件);

if (response == 0) {

alert(图片 + fileObj.name + 操作失败);

return false;

}else{

var str=$(#image).html();

var add="";

str+=add;

$(#image).html(str);

return true;

}

}

//上传发生错误时。

function funError(event, ID, fileObj, errorObj) {

//alert(错误事件);

alert(errorObj.info);

return;

}

上传|

控制器类:

<?php

/*

* 新闻类

*/

class ArticleAction extends Action{

//

/*public function load()

{

import(@.ORG.editor);

$ob=new editor("800px",400px,editor);

$str=$ob->userJs();

$editor=$ob->createEditor();

$this->assign("str",$str);

$this->assign("editor",$editor);

$this->display();

}

//

public function php()

{

import(@.ORG.editor);

$ob=new editor( );

$content=$ob->getEditorContent();

$this->assign(content,$content);

$this->display();

} */

public function file()

{

//加载文件上传,图片处理类

import("@.ORG.UploadFile");

//导入上传类

$upload = new UploadFile();

//设置上传文件大小

$upload->maxSize=3292200;

//设置上传文件类型

$upload->allowExts=explode(,,jpg,gif,png,jpeg);

//设置附件上传目录

$upload->savePath=./Uploads/;

//设置需要生成缩略图,仅对图像文件有效

$upload->thumb = true;

// 设置引用图片类库包路径

$upload->imageClassPath =@.ORG.Image;

//设置需要生成缩略图的文件后缀

$upload->thumbPrefix=m_,s_; //生产2张缩略图

//设置缩略图最大宽度

$upload->thumbMaxWidth=400,100;

//设置缩略图最大高度

$upload->thumbMaxHeight=400,100;

//设置上传文件规则

$upload->saveRule=uniqid;

//删除原图

$upload->thumbRemoveOrigin=true;

if( !$upload->upload() )

{

echo ;

}else{

$info=$upload->getUploadFileInfo();

$src=s_.$info[0][savename];

echo $src;

}

}

public function preview ()

{

$this->display();

}

}

AD:真正免费,域名+虚机+企业邮箱=0元

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。