Yii uploadify Batch upload, yiiuploadify batch
Controller:
$reinfo = "Fail";
$filename = "";
Important NOTES:
With Uploadify uploads, every time this sessionid changes,
The negative effect of the change is that it is no longer possible to acquire other session values under the SessionID line, such as the Yii::app ()->session[' ik ' value.
But the value of this place does not change, still need to use the value of Yii::app ()->session[' IK ') for verification,
So be sure to use this sentence session_id ($pse); The function is to change the SessionID back, in line with the original SessionID, in order to get the value smoothly
With this value, the original SessionID and post-upload sessionID are consistent.
Echo Yii::app ()->session->sessionid; This is the way Yii gets sessionid.
2014-10-14 13:04 W.one
$pse =yii::app ()->request->getparam (' phpsession ');
session_id ($pse);
/*
* If you do not use the sentence, Yii::app ()->session[' ik ']== $who is unlikely to be equal because 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 ');//Gets the 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" and "= $filename)");
View
http://www.bkjia.com/PHPjc/973027.html www.bkjia.com true http://www.bkjia.com/PHPjc/973027.html techarticle Yii uploadify Batch upload, yiiuploadify batch controller: $reinfo = "fail"; $filename = "";//Important NOTE://Use uploadify upload, each time this sessionid will change,/ /change ...