本文整理汇总了PHP中Varien_File_Uploader::setFilenamesCaseSensitivity方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_File_Uploader::setFilenamesCaseSensitivity方法的具体用法?PHP Varien_File_Uploader::setFilenamesCaseSensitivity怎么用?PHP Varien_File_Uploader::setFilenamesCaseSensitivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_File_Uploader
的用法示例。
在下文中一共展示了Varien_File_Uploader::setFilenamesCaseSensitivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAvatarFile
public function saveAvatarFile()
{
$uploadedFile = null;
if ($fileData = $this->getAvatarFileData()) {
$uploader = new Varien_File_Uploader($this->getAvatarFileData());
$uploader->setFilesDispersion(true);
$uploader->setFilenamesCaseSensitivity(false);
$uploader->setAllowRenameFiles(true);
$uploader->setAllowedExtensions($this->_supportedExtensions);
$uploader->save($this->getAvatarBasePath(), $fileData['name']);
$uploadedFile = $uploader->getUploadedFileName();
}
return $uploadedFile;
}
示例2: compactValue
/**
* Export attribute value to entity model
*
* @param Mage_Core_Model_Abstract $entity
* @param array|string $value
* @return Mage_Eav_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;
}
}
$path = Mage::getBaseDir('media') . DS . $attribute->getEntity()->getEntityTypeCode();
// unlink entity file
if ($toDelete) {
$this->getEntity()->setData($attribute->getAttributeCode(), '');
$file = $path . $original;
$ioFile = new Varien_Io_File();
if ($ioFile->fileExists($file)) {
$ioFile->rm($file);
}
}
if (!empty($value['tmp_name'])) {
try {
$uploader = new Varien_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;
}
示例3: saveAction
public function saveAction()
{
$post_data = $this->getRequest()->getPost();
if ($post_data) {
try {
$path = Mage::getBaseDir('media') . DS . 'cdz' . DS . 'revslideshow' . DS . 'images';
foreach ($_FILES as $key => $value) {
$temp = explode("_", $key);
if (!empty($value['tmp_name'])) {
try {
$uploader = new Varien_File_Uploader($value);
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
$uploader->setFilesDispersion(false);
$uploader->setFilenamesCaseSensitivity(false);
$uploader->setAllowRenameFiles(true);
$imageName = Mage::helper('revslideshow')->replaceFileName($value['name']);
$uploader->save($path, $imageName);
$fileName = $uploader->getUploadedFileName();
$post_data['slider'][$temp[1]]['image'] = $fileName;
} catch (Exception $e) {
Mage::logException($e);
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
}
}
foreach ($post_data['slider'] as $key => $value) {
if (!$post_data['slider'][$key]['image']) {
$post_data['slider'][$key]['image'] = $value[$key]['image'];
}
}
$model = Mage::getModel("revslideshow/revslideshow");
if (isset($post_data["duplicate"])) {
$model->setId();
} else {
$model->setId($this->getRequest()->getParam("id"));
}
$post_data['general_settings'] = json_encode($post_data['general_settings'], JSON_HEX_TAG);
$post_data['appearance'] = json_encode($post_data['appearance'], JSON_HEX_TAG);
$post_data['loop'] = json_encode($post_data['loop'], JSON_HEX_TAG);
$post_data['mobile_settings'] = json_encode($post_data['mobile_settings'], JSON_HEX_TAG);
$post_data['navigation'] = json_encode($post_data['navigation'], JSON_HEX_TAG);
$post_data['parallax'] = json_encode($post_data['parallax'], JSON_HEX_TAG);
$post_data['spinner'] = json_encode($post_data['spinner'], JSON_HEX_TAG);
$post_data['slider'] = json_encode($post_data['slider'], JSON_HEX_TAG);
$post_data['thumbnails'] = json_encode($post_data['thumbnails'], JSON_HEX_TAG);
$model->addData($post_data);
$model->save();
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Revslideshow was successfully saved"));
Mage::getSingleton("adminhtml/session")->setRevslideshowData(false);
if ($this->getRequest()->getParam("back")) {
$this->_redirect("*/*/edit", array("id" => $model->getId()));
return;
}
$this->_redirect("*/*/");
return;
} catch (Exception $e) {
Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
Mage::getSingleton("adminhtml/session")->setRevslideshowData($this->getRequest()->getPost());
$this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
return;
}
}
$this->_redirect("*/*/");
}