本文整理汇总了PHP中Mage_Core_Model_File_Uploader::setFilenamesCaseSensitivity方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_File_Uploader::setFilenamesCaseSensitivity方法的具体用法?PHP Mage_Core_Model_File_Uploader::setFilenamesCaseSensitivity怎么用?PHP Mage_Core_Model_File_Uploader::setFilenamesCaseSensitivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_File_Uploader
的用法示例。
在下文中一共展示了Mage_Core_Model_File_Uploader::setFilenamesCaseSensitivity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compactValue
/**
* Export attribute value to entity model
*
* @param Mage_Core_Model_Abstract $entity
* @param array|string $value
* @return Mage_Customer_Model_Attribute_Data_File
*/
public function compactValue($value)
{
if ($this->getIsAjaxRequest()) {
return $this;
}
$attribute = $this->getAttribute();
$original = $this->getEntity()->getData($attribute->getAttributeCode());
$toDelete = false;
if ($original) {
if (!$attribute->getIsRequired() && !empty($value['delete'])) {
$toDelete = true;
}
if (!empty($value['tmp_name'])) {
$toDelete = true;
}
}
$ioFile = new Varien_Io_File();
$path = Mage::getBaseDir('media') . DS . 'customer';
$ioFile->open(array('path' => $path));
// unlink entity file
if ($toDelete) {
$this->getEntity()->setData($attribute->getAttributeCode(), '');
$file = $path . $original;
if ($ioFile->fileExists($file)) {
$ioFile->rm($file);
}
}
if (!empty($value['tmp_name'])) {
try {
$uploader = new Mage_Core_Model_File_Uploader($value);
$uploader->setFilesDispersion(true);
$uploader->setFilenamesCaseSensitivity(false);
$uploader->setAllowRenameFiles(true);
$uploader->save($path, $value['name']);
$fileName = $uploader->getUploadedFileName();
$this->getEntity()->setData($attribute->getAttributeCode(), $fileName);
} catch (Exception $e) {
Mage::logException($e);
}
}
return $this;
}