Yii uploadify Bulk Upload, yiiuploadify batch _php tutorial

Source: Internet
Author: User

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.