Yii Uploadify batch upload
Controller:
$reinfo = "fail";
$filename="";
//Important note:
//When uploading using uploadify, the sessionID will change every time,
//The adverse effect after the change is that the sessionID can no longer be obtained Other offline session values, such as the value of Yii::app()->session['ik'], have changed.
//But the value in this place cannot be changed. You still need to use the value of Yii::app()->session['ik'] for verification.
//So you must use this session_id($pse); function It is to change the sessionID back to be consistent with the original sessionID so that the value can be obtained smoothly
//With this value, the original sessionID and the sessionID after uploading are consistent.
//echo Yii::app()->session->sessionID; This is how Yii gets sessionID
//2014-10-14 13:04 W.one
$pse = Yii::app() ->request->getParam('PHPSESSION');
session_id($pse);
/*
* If the previous sentence is not used, Yii::app()->session['ik']== $who cannot be equal because the sessionID has changed
*/
$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');//The obtained album ikey, the default is please select, the value is empty, be sure to select a value
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:
The above introduces Yii Uploadify batch upload, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Session failure is usually caused by the session lifetime expiration or server shutdown. The solutions: 1. Extend the lifetime of the session; 2. Use persistent storage; 3. Use cookies; 4. Update the session asynchronously; 5. Use session management middleware.

Solution to the cross-domain problem of PHPSession In the development of front-end and back-end separation, cross-domain requests have become the norm. When dealing with cross-domain issues, we usually involve the use and management of sessions. However, due to browser origin policy restrictions, sessions cannot be shared by default across domains. In order to solve this problem, we need to use some techniques and methods to achieve cross-domain sharing of sessions. 1. The most common use of cookies to share sessions across domains

1. Implementing SMS login based on session 1.1 SMS login flow chart 1.2 Implementing sending SMS verification code Front-end request description: Description of request method POST request path /user/code request parameter phone (phone number) return value No back-end interface implementation: @Slf4j@ ServicepublicclassUserServiceImplextendsServiceImplimplementsIUserService{@OverridepublicResultsendCode(Stringphone,HttpSessionsession){//1. Verify mobile phone number if

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

JavaScriptCookies Using JavaScript cookies is the most effective way to remember and track preferences, purchases, commissions and other information. Information needed for a better visitor experience or website statistics. PHPCookieCookies are text files that are stored on client computers and retained for tracking purposes. PHP transparently supports HTTP cookies. How do JavaScript cookies work? Your server sends some data to your visitor's browser in the form of a cookie. Browsers can accept cookies. If present, it will be stored on the visitor's hard drive as a plain text record. Now, when a visitor reaches another page on the site

With the continuous development of cloud computing technology, data backup has become something that every enterprise must do. In this context, it is particularly important to develop a highly available cloud backup system. The PHP framework Yii is a powerful framework that can help developers quickly build high-performance web applications. The following will introduce how to use the Yii framework to develop a highly available cloud backup system. Designing the database model In the Yii framework, the database model is a very important part. Because the data backup system requires a lot of tables and relationships

1. Introduction to Session In Web applications, Session is a data structure saved on the Web server and used to store user information. When a user visits a website, the server creates a Session and sends the Session ID to the client browser. When the browser returns a request, it will bring the ID of the Session. The server can find the user's Session through the ID and read or modify the user's information from the Session. The role of Session can be summarized into the following aspects: storing user information. For example, the user's login status, shopping cart contents, form data, etc. Achieve cross-page data sharing
