zend-file

Zend File Upload and Element Decorators

末鹿安然 提交于 2019-12-28 04:31:07
问题 I have the problem, that the following Zend Form throws an error. The problem is the "file"-element and using setElementDecorators. class Products_AddForm extends Zend_Form { function init() { // other form elements... $uploadElement = new Zend_Form_Element_File('Excel'); $uploadElement->setLabel('Excel'); $this->addElement($uploadElement); $this->setElementDecorators(array( 'ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'th')),

Zend_File_Transfer w/multiple files does not upload equally

白昼怎懂夜的黑 提交于 2019-12-21 20:40:56
问题 Weird title, yes, but the problem is simple; simply aggrevating. I have a form, that I built without using Zend_Form, and it has two file uploads: <input name="image" type="file" /> <input name="file" type="file" /> Here is the chunk of code from my controller that is handling the upload. There's actually a little more, but this is the relevant piece: $data['image'] = (isset($_FILES["image"]) && $_FILES["image"]["name"] ? $_FILES["image"]["name"] : NULL); $data['file'] = (isset($_FILES["file"

Zend Zend_File_Transfer_Adapter_Http renaming question

纵饮孤独 提交于 2019-12-04 23:52:48
问题 I've got a question about renaming a file after it's been uploaded in Zend. I don't know where to put the Rename Filter. Here's what I've got. I've tried moving things around, but I'm lost. Currently it does upload the file to my photos folder, but it doesn't rename it. Thanks for any help! if($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $adapter = new Zend_File_Transfer_Adapter_Http(); $adapter->setDestination(WWW_ROOT . '/photos');

Zend_File_Transfer w/multiple files does not upload equally

江枫思渺然 提交于 2019-12-04 12:48:08
Weird title, yes, but the problem is simple; simply aggrevating. I have a form, that I built without using Zend_Form, and it has two file uploads: <input name="image" type="file" /> <input name="file" type="file" /> Here is the chunk of code from my controller that is handling the upload. There's actually a little more, but this is the relevant piece: $data['image'] = (isset($_FILES["image"]) && $_FILES["image"]["name"] ? $_FILES["image"]["name"] : NULL); $data['file'] = (isset($_FILES["file"]) && $_FILES["file"]["name"] ? $_FILES["file"]["name"] : NULL); $options = array('ignoreNoFile' =>

PHP: How to rename a file uploaded with Zend_Form_Element_File?

本秂侑毒 提交于 2019-12-03 05:36:30
问题 Form: //excerpt $file = new Zend_Form_Element_File('file'); $file->setLabel('File to upload:') ->setRequired(true) ->addValidator('NotEmpty') ->addValidator('Count', false, 1) ->setDestination(APPLICATION_UPLOADS_DIR); $this->addElement($file); Controller: //excerpt if ($form->isValid($request->getPost()) { $newFilename = 'foobar.txt'; //how should I rename the file? //When should I rename the file? Before or after receiving? try { $form->file->receive(); echo 'filename: '. $form->file-

Zend File Upload and Element Decorators

穿精又带淫゛_ 提交于 2019-11-27 16:08:47
I have the problem, that the following Zend Form throws an error. The problem is the "file"-element and using setElementDecorators. class Products_AddForm extends Zend_Form { function init() { // other form elements... $uploadElement = new Zend_Form_Element_File('Excel'); $uploadElement->setLabel('Excel'); $this->addElement($uploadElement); $this->setElementDecorators(array( 'ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'th')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')) )); } } This throws an error. (Warning: