關於phpcms 中頭像上傳 那位高手說下怎麼實現的

來源:互聯網
上載者:User
關於phpcms 中頭像上傳 那位高手說下如何?的


圖片在flash中提交過來的zip壓縮包中,誰能告訴我,php是怎麼擷取到這個zip資源的?
------解決方案--------------------
phpsso_server\phpcms\modules\phpsso\classes\phpsso.class.php
第46行

$this->data['avatardata'] = $GLOBALS['HTTP_RAW_POST_DATA'];

post過來的資料。

file_pust_contents 根據資料,組建檔案(包括檔案地址)
你的代碼沒有貼完全

下面就是解壓縮了

//解壓縮檔案
pc_base::load_app_class('pclzip', 'phpsso', 0);
$archive = new PclZip($filename);
if ($archive->extract(PCLZIP_OPT_PATH, $dir) == 0) {
die("Error : ".$archive->errorInfo(true));
}

//判斷檔案安全,刪除壓縮包和非jpg圖片
$avatararr = array('180x180.jpg', '30x30.jpg', '45x45.jpg', '90x90.jpg');
if($handle = opendir($dir)) {
while(false !== ($file = readdir($handle))) {
if($file !== '.' && $file !== '..') {
if(!in_array($file, $avatararr)) {
@unlink($dir.$file);
} else {
$info = @getimagesize($dir.$file);
if(!$info
------解決方案--------------------
$info[2] !=2) {
@unlink($dir.$file);
}
}
}
}
closedir($handle);
}
$this->db->update(array('avatar'=>1), array('uid'=>$this->uid));
exit('1');
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.