當前位置: 首頁>>代碼示例>>PHP>>正文


PHP myContentStorage::getTempUploadHash方法代碼示例

本文整理匯總了PHP中myContentStorage::getTempUploadHash方法的典型用法代碼示例。如果您正苦於以下問題:PHP myContentStorage::getTempUploadHash方法的具體用法?PHP myContentStorage::getTempUploadHash怎麽用?PHP myContentStorage::getTempUploadHash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在myContentStorage的用法示例。


在下文中一共展示了myContentStorage::getTempUploadHash方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: uploadFile

 public static function uploadFile($file_data, $id, $filename, $hash, $extra_id = null)
 {
     $realHash = myContentStorage::getTempUploadHash($filename, $id);
     // TODO - what if there is  an error while uploading ?
     // filename is OK?
     if ($realHash == $hash && $hash != "") {
         //create the directory if doesn't exists (should have write permissons)
         // if(!is_dir("./files")) mkdir("./files", 0755);
         //move the uploaded file
         $origFilename = $file_data['name'];
         $parts = pathinfo($origFilename);
         $extension = strtolower($parts['extension']);
         $filename = $id . '_' . $filename;
         // add the file extension after the "." character
         $fullPath = myContentStorage::getFSUploadsPath() . $filename . ($extra_id ? "_" . $extra_id : "") . "." . $extension;
         myContentStorage::fullMkdir($fullPath);
         if (!move_uploaded_file($file_data['tmp_name'], $fullPath)) {
             KalturaLog::log("Error while uploading [{$id}] [{$filename}] [{$hash}] [{$extra_id}] " . print_r($file_data, true) . "\n->[{$fullPath}]");
             return false;
         }
         @chmod($fullPath, 0777);
         return true;
     }
     return false;
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:25,代碼來源:myUploadUtils.class.php

示例2: getTempUploadUrlParams

 /**
  * This function returns the upload url paramters needed to securely upload a file.
  * The resulting parameters are filename and hash.
  * The filename is the given entity name (thumbnail, audio, etc...)
  * The hash is generated using the myContentStorage::getTempUploadHash function.
  * @param string $entityName = the entity object name
  * @param int $kuser_id = the uploading kuser id
  * @return string the url parameters string
  */
 public static function getTempUploadUrlParams($entityName, $kuser_id, $user = NULL)
 {
     // TODO - i added  this becuase it took me 3 hours to find this bug.
     // it's clear that the module from which this is called should enforce logging in, but i added this extra defence - Eran ??
     if ($kuser_id == NULL || strlen($kuser_id) == 0) {
         throw new Exception("Should not be called when user is not logged in !");
     }
     $hash = myContentStorage::getTempUploadHash($entityName, $kuser_id, $user);
     if ($hash != "") {
         return "?id={$kuser_id}&filename={$entityName}&hash={$hash}";
     }
     return "";
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:22,代碼來源:myContentStorage.class.php


注:本文中的myContentStorage::getTempUploadHash方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。