Table of Contents
Yii Uploadify批量上传,yiiuploadify批量
Home php教程 php手册 Yii Uploadify批量上传,yiiuploadify批量

Yii Uploadify批量上传,yiiuploadify批量

Jun 13, 2016 am 09:09 AM
yii upload batch

Yii Uploadify批量上传,yiiuploadify批量

控制器:

 

$reinfo = "fail";
$filename="";
//重要说明:
//使用uploadify 上传时,每次这个sessionID都会改变,
//改变之后出现的不利影响就是无法再获取sessionID线下的其它session值,比如 Yii::app()->session['ik'] 值就变了。
//但是这个地方值不能变,仍要用 Yii::app()->session['ik'] 的值来作验证,
//因此一定要使用这句 session_id($pse); 作用是将sessionID改回来,与原来的sessionID一致,以便顺利获取值
//有了该值之后,原来的 sessionID 和 上传之后的 sessionID 是一致的。
//echo Yii::app()->session->sessionID; 这是Yii获取sessionID的方法
//2014-10-14 13:04 W.one
$pse = Yii::app()->request->getParam('PHPSESSION');
session_id($pse);
/*
* 如果不使用上句的话,Yii::app()->session['ik']==$who 是不可能相等的,因为sessionID变了
*/
$who = (int)Yii::app()->request->getParam('who');
$sjm = Yii::app()->request->getParam('sjm');
$zlsjm = Yii::app()->request->getParam("zlsjm");
//$xceikey = (int)Yii::app()->request->getParam('xceikey');//获取的相册ikey,默认为请选择,值为空,一定要选择一个值
if ($who==Yii::app()->session['ik']){
$sjz = time();
$tempFile = $_FILES['Filedata'];
$checkType = pathinfo($tempFile["name"],PATHINFO_EXTENSION);
if ($checkType != "notimg"){
$targetPath = $_SERVER['DOCUMENT_ROOT'] . '/oa/upload/file/';
$scfile = date("Y").date("m").date("d").date("His")."_".$who."_".md5(microtime()).".".$checkType;
$targetFile = str_replace('//','/',$targetPath) . $scfile;
if (move_uploaded_file($tempFile['tmp_name'],$targetFile)){
$relativeurl = "./upload/file/".$scfile;
//$relativeurl = $tempFile["name"];
$zlfj = new Zlfj();
$zlfj->fj_zlsjm = $zlsjm;
$zlfj->fj_uikey = Yii::app()->session["ik"];
$zlfj->fj_path = "./upload/file/".$scfile;
$zlfj->fj_time = time();
$zlfj->fj_name = $tempFile["name"];
if($zlfj->validate()&&$zlfj->save()){
$reinfo = $relativeurl;
$filename=$tempFile["name"];
}else{
@unlink($targetFile);
}

}
}
}
echo CJSON::encode(array("info"=>"$reinfo","name"=>$filename));

 

 

 

view:

 

//当用户选定文件,点确定后触发,每个文件将会触发一次
'onSelect':function(file){

},

'onUploadStart' : function(file) {
$("#xceimgs2").uploadify("settings", "formData",{'zlsjm':$("#juece_zlsjm").val(),'zlikey':$("#juece_zlikey").val()});
},

'onUploadSuccess':function(file, data, response){
json=eval("("+data+")");
//alert(json["name"]);return false;
//不等于fail表明上传成功
if(json.info!="fail"){
$("#jueceim"+ii).attr("src","");
$("#jueceb"+ii).text(json.name);
$("#juecedele"+ii).attr("src","");
$("#juecedele"+ii).attr("value",json.info);
ii++;
}
},

//返回一个错误,选择文件的时候触发
'onSelectError':function(file, errorCode, errorMsg){
switch(errorCode) {
case -100:
alert("上传的文件数量已经超出系统限制的 50 个文件!");
break;
case -110:
alert("文件 ["+file.name+"] 大小超出系统限制的"+$('#xceimgs2').uploadify('settings','fileSizeLimit')+"大小!");
break;
case -120:
alert("文件 ["+file.name+"] 大小异常!");
break;
case -130:
alert("文件 ["+file.name+"] 类型不正确!");
break;
default:
}
}
});
});

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement file upload and processing in FastAPI How to implement file upload and processing in FastAPI Jul 28, 2023 pm 03:01 PM

How to implement file upload and processing in FastAPI FastAPI is a modern, high-performance web framework that is easy to use and powerful. It provides native support for file upload and processing. In this article, we will learn how to implement file upload and processing functions in the FastAPI framework, and provide code examples to illustrate specific implementation steps. First, we need to import the required libraries and modules: fromfastapiimportFastAPI,UploadF

How to batch rename file suffixes in win10 How to batch rename file suffixes in win10 Jul 06, 2023 pm 07:37 PM

How to batch rename file suffixes in win10? Nowadays, many users are using the Win10 system, and when we usually use computers, we often use a lot of shortcut keys, because shortcut keys can make our operations more convenient, so how do we rename files in batches? Below, the editor will introduce to you the operation of batch renaming files in Win10. How to batch rename files in Win10 1. Select all the files you want to rename. 2. Right-click on a selected file and select Rename. 3. After a file is renamed, other files will be marked with serial numbers in turn. The method is very simple, but when modifying, you need to pay attention to the order of the files and the sorting position of the modified sample files. The serial number starts from the modified sample file.

How to solve the problem of slow upload speed on Win10 computer How to solve the problem of slow upload speed on Win10 computer Jul 01, 2023 am 11:25 AM

How to solve the slow upload speed of Win10 computer? When we use the computer, we may feel that the file upload speed of our computer is very slow. So what is the situation? In fact, this is because the default upload speed of the computer is 20%, so the upload speed is very slow. Many friends do not know how to operate in detail. The editor has compiled the steps to format the C drive in Win11 below. If you are interested, follow Let’s take a look below! Solution to the slow upload speed of Win10 1. Press win+R to call up run, enter gpedit.msc, and press Enter. 2. Select the management template, click Network--Qos Packet Scheduler, and double-click Limit to reserve bandwidth. 3. Select Enabled, which will bring

How to upload lyrics to QQ Music How to upload lyrics to QQ Music Feb 23, 2024 pm 11:45 PM

With the advent of the digital age, music platforms have become one of the main ways for people to obtain music. However, sometimes when we listen to songs, we find that there are no lyrics, which is very disturbing. Many people hope that lyrics can be displayed when listening to songs to better understand the content and emotions of the songs. QQ Music, as one of the largest music platforms in China, also provides users with the function of uploading lyrics, so that users can better enjoy music and feel the connotation of the songs. The following will introduce how to upload lyrics on QQ Music. first

Simple steps to upload your own music on Kugou Simple steps to upload your own music on Kugou Mar 25, 2024 pm 10:56 PM

1. Open Kugou Music and click on your profile picture. 2. Click the settings icon in the upper right corner. 3. Click [Upload Music Works]. 4. Click [Upload Works]. 5. Select the song and click [Next]. 6. Finally, click [Upload].

How to improve computer upload speed How to improve computer upload speed Jan 15, 2024 pm 06:51 PM

Upload speed becomes very slow? I believe this is a problem that many friends will encounter when uploading things on their computers. If the network is unstable when using a computer to transfer files, the upload speed will be very slow. So how can I increase the network upload speed? Below, the editor will tell you how to solve the problem of slow computer upload speed. When it comes to network speed, we all know that the speed of opening web pages, download speed, and upload speed are also very critical. Especially some users often need to upload files to the network disk, so a fast upload speed will undoubtedly save you a lot of money. Less time, what should I do if the upload speed is slow? Below, the editor brings you pictures and texts on how to deal with slow computer upload speeds. How to solve the problem of slow computer upload speed? Click "Start--Run" or "Window key"

How to take photos and upload them on computer How to take photos and upload them on computer Jan 16, 2024 am 10:45 AM

As long as the computer is equipped with a camera, it can take pictures, but some users still don't know how to take pictures and upload them. Now I will give you a detailed introduction to the method of taking pictures on the computer, so that users can upload the pictures wherever they want. How to take photos and upload them on a computer 1. Mac computer 1. Open Finder and click the application on the left. 2. After opening, click the Camera application. 3. Just click the photo button below. 2. Windows computer 1. Open the search box below and enter camera. 2. Then open the searched application. 3. Click the photo button next to it.

How to implement video playback and upload functions through the PHP Kuaishou API interface How to implement video playback and upload functions through the PHP Kuaishou API interface Jul 21, 2023 pm 04:37 PM

How to implement video playback and upload functions through the PHP Kuaishou API interface. Introduction: With the rise of social media, the public’s demand for video content has gradually increased. Kuaishou, as a short video-themed social application, is loved by many users. This article will introduce how to use PHP to write code to implement video playback and upload functions through the Kuaishou API interface. 1. Obtain the access token. Before using the Kuaishou API interface, you first need to obtain the access token. Token is the identity for accessing the API interface

See all articles