File upload Issue after upgrading cakephp from 2.3.9 to to 2.7.5
I have fixed most issues after the upgrade but one I just can't seem to solve. I hope someone can help me. I created a few years ago this upload form/functionality in the admin section to give the admin user the possibility to upload images for a property in a region. The admin user select the Region, then the Property then browse over his drive to select a file, enter the image alt 'description' and then finally hit the Upload Image button. This form worked perfect in cakephp version 2.3.9. But after the upgrade it fails with "Internal Server error" in all Windows browsers, it looks like it has a problem with the 'temp' file location of this file I know they have changed so much in cakePHP i just wonder what setting/folder is just for this temp filename when you submit the form... I checked the /user/local/apache/domlogs, I checked the /var/log/messages. I also checked in the /app/tmp/logs/ nothing... I have enabled the debug option. nothing.. I have tried to put a die(); on several places, but I am just puzzled, the form works as supposed I can't get anything faulty, but as soon as I press the button Upload Image. the error comes with blank screen and error: Internal Server error www.domain.com/admin/uploads. View Session->flash(); ?> Form->create('Upload', array('type' => 'file')); ?> Form->input('region_id', array('label' => 'Select Region:')); ?> Form->input('property_id', array('label' => 'Select Property:')); ?> Form->file('file'); ?> Form->input('description', array('label' => 'Image Alt = [Specify an alternate text for the image]:')); ?> Form->submit(__('Upload Image', true)); ?> Controller set('title_for_layout', 'Upload controller - '); // Retrieve the region list $this->set('regions', $this->Region->find('list', array( 'fields' => array('Region.id', 'Region.regionname'), 'order' => 'regionname', ))); // Retrieve the properties list $this->set('properties', $this->Property->find('list', array( 'fields' => array('Property.id', 'Property.ref', 'Property.description'), 'order' => 'ref', ))); if (isset($this->request->data['Upload']['region_id'])) { // Image selected? if ($this->request->data['Upload']['file']['name'] == '') { $this->Session->setFlash('Please, select an image to upload.'); $this->redirect($this->referer()); } // All required data is collected. // Prepare uploading file to the server and store in the db. // Check if folder exist to store the Image in. $this->Region->recursive = 0; $propertyid = ($this->request->data['Upload']['property_id']); $property = ($this->Property->findById($propertyid)); $propertyref = $property['Property']['ref']; $regionid = ($this->request->data['Upload']['region_id']); $regionname = ($this->Region->findById($regionid)); $cdest = $regionname['Country']['countryname']; // Set Folder -> Country $rdest = $regionname['Region']['regionname']; // Set Folder -> Regionname $destination = (ROOT.DS.WEBROOT_DIR.DS.'img'.DS.$cdest.DS.$rdest.DS); //debug($destination); //$destination = (App.imageBaseUrl.DS.$cdest.DS.$rdest.DS); //debug($destination); // Folder exist? $folder = new Folder($destination); $folderexist = $folder->cd($destination); // Returns False on failure. if ($folderexist == false ) { // Create new folder. $folder->create($destination); } // Create the Filename. $tmp_name = ($this->request->data['Upload']['file']['tmp_name']); $filename = ($this->request->data['Upload']['file']['name']); $fileprefix = $propertyref; // New filename. $filext = substr($filename, -4); // Keep file extension. // Count the files in the destination folder. $dir = new Folder($destination); // Destination folder. $files = $dir->find('$propertyref.*', true); // Creates array with filenames. $counter = count($files); // Count the files. if ($counter == 0){ // No such files $counter = $counter + 1; // First image. } $filemid = sprintf('%01d', $counter); // Add number to filename. $filename = ($fileprefix.$filemid.$filext); // Put the parts together. // Check if the file exist. if (file_exists($destination.$filename)) { // Yes, we need to increase the counter. while (file_exists($destination.$filename)) { $counter = $counter + 1; $filemid = sprintf('%01d', $counter); $filename = ($fileprefix.$filemid.$filext); //debug($filename); }} // Upload the file to the server/folder. move_uploaded_file($tmp_name, $destination . $filename); // Prepare for writing to the database. $filesize = ($this->request->data['Upload']['file']['size']); $createdt = date('Y-m-d H:i:s'); $description = ($this->request->data['Upload']['description']); if ($description == '') { // Is the Tag/Description empty? $description = $filename; // Yes, we use the filename. } // Create the Array with correct name and fields for the DB. $this->request->data['PropertyImage']['filename'] = $cdest.DS.$rdest.DS.$filename; $this->request->data['PropertyImage']['filesize'] = $filesize; $this->request->data['PropertyImage']['description'] = $desc
File upload from form with Http Client
I have read the part about the Http Client: $http = new Client();$response = $http->post('http://example.com/api', [ 'image' => '@/path/to/a/file', 'logo' => $fileHandle]); and I have read the part about file input: echo $this->Form->create($article, ['type' => 'file']); But how can I combine them so that the file from the form is uploaded? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: File upload validation
I think we have a misunderstanding. The code I sent you was for your model. The only thing that changes was you had some code in the "afterValidate" function and I provided you with an alternative to do all the legwork in the "beforeValidate" function. If you use "beforeValidate" you can do all the photo uploading and field-setting logic and return TRUE. Alternatively, you can return FALSE to prevent further validation if there is an error. *NOTE: If *beforeValidate* returns FALSE CakePHP will short-circuit and "* validates()*" DOES NOT execute. * *NOTE: If *beforeValidate* returns TRUE CakePHP will execute "*validates()*". **Performing the file upload in the *afterValidate* function is TOO LATE; The Model has already attempted to validate your field "*photo*" and the error is already set before *afterValidate* callback event is executed.* *NOTE: The function **afterValidate** is called by the ModelValidator object inside the **errors* * function. The ModelValidator **errors** function performs tests all the fields, sets errors, and finally executes * afterValidate* before returning.* SEE: http://book.cakephp.org/2.0/en/models/callback-methods.html Sincerely, Charles A Beasley On Sun, Mar 1, 2015 at 5:56 AM, Sam Clauw wrote: > Charles, thank you for the great effort! > But is there no other option than move the validation into the controller > instead of doing it in the model? > > The code I wrote only contains one single if/else and is very clear to me. > Okay, it's not working so I'm not getting anywhere for the moment huh ;) > > Can you confirm that extension rule in CakePHP is validation the ['type'] > variable in the FILES array? If "yes", I realy don't understand why I keep > getting validation errors on the validExtension rule :s > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: File upload validation
Charles, thank you for the great effort! But is there no other option than move the validation into the controller instead of doing it in the model? The code I wrote only contains one single if/else and is very clear to me. Okay, it's not working so I'm not getting anywhere for the moment huh ;) Can you confirm that extension rule in CakePHP is validation the ['type'] variable in the FILES array? If "yes", I realy don't understand why I keep getting validation errors on the validExtension rule :s -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: File upload validation
You can get rid of the $unset_photo variable I didn't end up using it. --Charles On Sat, Feb 28, 2015 at 6:48 PM, Charles Beasley wrote: > I'm sorry.. I replied quickly via cell phone. A better response is as > follows. > > Try the following code: > > > > class Outlet extends CoasterCmsAppModel > > { > > public $validate = array( > > 'name' => array( > > 'rule' => 'notEmpty', // verplicht > > 'message' => 'Nameis required.', > > 'allowEmpty' => true > > ), > > 'intro' => array( > > 'rule' => 'notEmpty', // verplicht > > 'message' => 'Intro is required.' > > ), > > 'photo' => array( > > 'validFileSize' => array( // zelf gekozen naam van de regel > > 'rule' => array('filesize', '>', 0), // verplicht > > 'on' => 'create', > > 'message' => 'Photo is required.' > > ) > > ), > > 'photoTemp' => array( > > 'validExtension' => array( // zelf gekozen naam van de regel > > 'rule' => array('extension', array('jpg', 'jpeg', 'png', > 'gif')), > > 'on' => 'create', > > 'message' => 'Photo has to contain a valid extension (jpg, > jpeg, png or gif).' > > ), > > 'validExtension' => array( // zelf gekozen naam van de regel > > 'rule' => array('extension', array('jpg', 'jpeg', 'png', > 'gif')), > > 'allowEmpty' => true, > > 'on' => 'update', > > 'message' => 'Photo has to contain a valid extension (jpg, > jpeg, png or gif).' > > ) > > ) > > ); > > > > public function beforeValidate() > > { > > $unset_photo = false; > > if ( is_array( $this->data['Outlet']['photo'] ) ) { > > $filename = false; > > $tmp_filename = false; > > $unset_photo = true; > > $upload_path = WWW_ROOT .'img' . DS . 'outlets' . DS; > > if ( isset( $this->data['Outlet']['photo']['name'] ) ) { > > $filename = trim($this->data['Outlet']['photo']['name']); > > } > > if ( isset( $this->data['Outlet']['photo']['tmp_name'] ) ) { > > $tmp_filename = > trim($this->data['Outlet']['photo']['tmp_name']); > > } > > if ( ! empty( $tmp_filename ) && ! empty( $filename ) ) { > > // Move the uploaded file to the new directory > > if(!move_uploaded_file($tmp_filename, $upload_path > basename($filename))) { > > /* > > * Handle upload error and return FALSE; e.g. > > * $this->validationErrors['Outlet']['photo'] = > 'Failed to upload file ' . $filename; > > */ > > } else { > > $this->data['Outlet']['photo'] = $filename; // SUCCESS > > } > > } else if ( ! empty( $this->data['Outlet']['photo'] ) ) ) { > > /* > > * Handle Invalid input error and return FALSE; e.g. > > * > > * $this->validationErrors['Outlet']['photo'] = > 'Invalid input: photo tmp_name required'; > > * $this->validationErrors['Outlet']['photo'] = > 'Invalid input: photo name required'; > > */ > > } else { > > /* > > * Silently unset and ignore an empty array. > > */ > > unset($this->data['Outlet']['photo']); > > } > > } > > } > > > ?> > > > On Sat, Feb 28, 2015 at 6:24 PM, Charles Beasley > wrote: > >> I think you should change your function to beforeValidate >> On Feb 28, 2015 5:54 PM, "Sam Clauw" wrote: >> >>> Okay Charles , that makes sense so I changed my code: >>> >>> >> >>> >>> class Outlet extends CoasterCmsAppModel >>> { >>> public $validate = array( >>> 'name' => array( >>> 'rule' => 'notEmpty', // verplicht >>> 'message' => 'Nameis required.', >>> 'allowEmpty' => true >>> ), >>> 'intro' => array( >>> 'rule' => 'notEmpty', // verplicht >>> 'message' => 'Intro is required.' >>> ), >>> 'photo' => array( >>> 'validFileSize' => array( // zelf gekozen naam van de regel >>> 'rule' => array('filesize', '>', 0), // verplicht >>> 'on' => 'create', >>> 'message' => 'Photo is required.' >>> ) >>> ), >>> 'photoTemp' => array( >>> 'validExtension' => array( // zelf gekozen naam van de regel >>> 'rule' => array('extension', array('jpg', 'jpeg', 'png', >>> 'gif')), >>> 'on' => 'create', >>> 'message' => 'Photo has to contain a valid extension >>> (jpg, jpeg,
Re: File upload validation
I'm sorry.. I replied quickly via cell phone. A better response is as follows. Try the following code: array( 'rule' => 'notEmpty', // verplicht 'message' => 'Nameis required.', 'allowEmpty' => true ), 'intro' => array( 'rule' => 'notEmpty', // verplicht 'message' => 'Intro is required.' ), 'photo' => array( 'validFileSize' => array( // zelf gekozen naam van de regel 'rule' => array('filesize', '>', 0), // verplicht 'on' => 'create', 'message' => 'Photo is required.' ) ), 'photoTemp' => array( 'validExtension' => array( // zelf gekozen naam van de regel 'rule' => array('extension', array('jpg', 'jpeg', 'png', 'gif')), 'on' => 'create', 'message' => 'Photo has to contain a valid extension (jpg, jpeg, png or gif).' ), 'validExtension' => array( // zelf gekozen naam van de regel 'rule' => array('extension', array('jpg', 'jpeg', 'png', 'gif')), 'allowEmpty' => true, 'on' => 'update', 'message' => 'Photo has to contain a valid extension (jpg, jpeg, png or gif).' ) ) ); public function beforeValidate() { $unset_photo = false; if ( is_array( $this->data['Outlet']['photo'] ) ) { $filename = false; $tmp_filename = false; $unset_photo = true; $upload_path = WWW_ROOT .'img' . DS . 'outlets' . DS; if ( isset( $this->data['Outlet']['photo']['name'] ) ) { $filename = trim($this->data['Outlet']['photo']['name']); } if ( isset( $this->data['Outlet']['photo']['tmp_name'] ) ) { $tmp_filename = trim($this->data['Outlet']['photo']['tmp_name']); } if ( ! empty( $tmp_filename ) && ! empty( $filename ) ) { // Move the uploaded file to the new directory if(!move_uploaded_file($tmp_filename, $upload_path basename($filename))) { /* * Handle upload error and return FALSE; e.g. * $this->validationErrors['Outlet']['photo'] = 'Failed to upload file ' . $filename; */ } else { $this->data['Outlet']['photo'] = $filename; // SUCCESS } } else if ( ! empty( $this->data['Outlet']['photo'] ) ) ) { /* * Handle Invalid input error and return FALSE; e.g. * * $this->validationErrors['Outlet']['photo'] = 'Invalid input: photo tmp_name required'; * $this->validationErrors['Outlet']['photo'] = 'Invalid input: photo name required'; */ } else { /* * Silently unset and ignore an empty array. */ unset($this->data['Outlet']['photo']); } } } ?> On Sat, Feb 28, 2015 at 6:24 PM, Charles Beasley wrote: > I think you should change your function to beforeValidate > On Feb 28, 2015 5:54 PM, "Sam Clauw" wrote: > >> Okay Charles , that makes sense so I changed my code: >> >> > >> >> class Outlet extends CoasterCmsAppModel >> { >> public $validate = array( >> 'name' => array( >> 'rule' => 'notEmpty', // verplicht >> 'message' => 'Nameis required.', >> 'allowEmpty' => true >> ), >> 'intro' => array( >> 'rule' => 'notEmpty', // verplicht >> 'message' => 'Intro is required.' >> ), >> 'photo' => array( >> 'validFileSize' => array( // zelf gekozen naam van de regel >> 'rule' => array('filesize', '>', 0), // verplicht >> 'on' => 'create', >> 'message' => 'Photo is required.' >> ) >> ), >> 'photoTemp' => array( >> 'validExtension' => array( // zelf gekozen naam van de regel >> 'rule' => array('extension', array('jpg', 'jpeg', 'png', >> 'gif')), >> 'on' => 'create', >> 'message' => 'Photo has to contain a valid extension >> (jpg, jpeg, png or gif).' >> ), >> 'validExtension' => array( // zelf gekozen naam van de regel >> 'rule' => array('extension', array('jpg', 'jpeg', 'png', >> 'gif')), >> 'allowEmpty' => true, >> 'on' => 'update', >> 'message' => 'Photo has to contain a valid extension >> (jpg, jpeg, png or gif).' >> ) >> ) >> ); >> >> public function beforeValidate() >> { >> $this->data['Outlet']['photoTemp'] = $this->data['
Re: File upload validation
I think you should change your function to beforeValidate On Feb 28, 2015 5:54 PM, "Sam Clauw" wrote: > Okay Charles , that makes sense so I changed my code: > > > > class Outlet extends CoasterCmsAppModel > { > public $validate = array( > 'name' => array( > 'rule' => 'notEmpty', // verplicht > 'message' => 'Nameis required.', > 'allowEmpty' => true > ), > 'intro' => array( > 'rule' => 'notEmpty', // verplicht > 'message' => 'Intro is required.' > ), > 'photo' => array( > 'validFileSize' => array( // zelf gekozen naam van de regel > 'rule' => array('filesize', '>', 0), // verplicht > 'on' => 'create', > 'message' => 'Photo is required.' > ) > ), > 'photoTemp' => array( > 'validExtension' => array( // zelf gekozen naam van de regel > 'rule' => array('extension', array('jpg', 'jpeg', 'png', > 'gif')), > 'on' => 'create', > 'message' => 'Photo has to contain a valid extension > (jpg, jpeg, png or gif).' > ), > 'validExtension' => array( // zelf gekozen naam van de regel > 'rule' => array('extension', array('jpg', 'jpeg', 'png', > 'gif')), > 'allowEmpty' => true, > 'on' => 'update', > 'message' => 'Photo has to contain a valid extension > (jpg, jpeg, png or gif).' > ) > ) > ); > > public function beforeValidate() > { > $this->data['Outlet']['photoTemp'] = $this->data['Outlet']['photo' > ]; > $this->data['Outlet']['photo'] = $this->data['Outlet']['photoTemp' > ]['name']; > } > > public function afterValidate() > { > $filename = $this->data['Outlet']['photo']; > > if (!empty($filename)) { > move_uploaded_file($this->data['Outlet']['photoTemp'][ > 'tmp_name'], WWW_ROOT . 'img' . DS . 'outlets' . DS . $filename); > } else { > unset($this->data['Outlet']['photo']); > } > > unset($this->data['Outlet']['photoTemp']); > } > } > > > However, I still get the error message that I should upload a file with a > correct extension. It's just like 'allowEmpty' => true" isn't working at > all. > I quess in my case it's checking the value in $this->data['Outlet'][ > 'photoTemp']['type'] so what could possibly be the problem? > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: File upload validation
Okay Charles , that makes sense so I changed my code: array( 'rule' => 'notEmpty', // verplicht 'message' => 'Nameis required.', 'allowEmpty' => true ), 'intro' => array( 'rule' => 'notEmpty', // verplicht 'message' => 'Intro is required.' ), 'photo' => array( 'validFileSize' => array( // zelf gekozen naam van de regel 'rule' => array('filesize', '>', 0), // verplicht 'on' => 'create', 'message' => 'Photo is required.' ) ), 'photoTemp' => array( 'validExtension' => array( // zelf gekozen naam van de regel 'rule' => array('extension', array('jpg', 'jpeg', 'png', 'gif')), 'on' => 'create', 'message' => 'Photo has to contain a valid extension (jpg, jpeg, png or gif).' ), 'validExtension' => array( // zelf gekozen naam van de regel 'rule' => array('extension', array('jpg', 'jpeg', 'png', 'gif')), 'allowEmpty' => true, 'on' => 'update', 'message' => 'Photo has to contain a valid extension (jpg, jpeg, png or gif).' ) ) ); public function beforeValidate() { $this->data['Outlet']['photoTemp'] = $this->data['Outlet']['photo']; $this->data['Outlet']['photo'] = $this->data['Outlet']['photoTemp'][ 'name']; } public function afterValidate() { $filename = $this->data['Outlet']['photo']; if (!empty($filename)) { move_uploaded_file($this->data['Outlet']['photoTemp']['tmp_name' ], WWW_ROOT . 'img' . DS . 'outlets' . DS . $filename); } else { unset($this->data['Outlet']['photo']); } unset($this->data['Outlet']['photoTemp']); } } However, I still get the error message that I should upload a file with a correct extension. It's just like 'allowEmpty' => true" isn't working at all. I quess in my case it's checking the value in $this->data['Outlet'][ 'photoTemp']['type'] so what could possibly be the problem? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: File upload validation
Sam: Based on your code the value for $this->data['Outlet']['photo'] is an array instead of a string field indicated by $validate and "$this->set('photo', $filename)". This suggests that the type for $this->data['Outlet'][ 'photo'] is transitioning from an array to a string. You would have to make sure that $this->data['Outlet']['photo'] contains a string value when validate() is executed. Is it possible that your afterValidate function is supposed to be beforeValidate? --Charles On Sat, Feb 28, 2015 at 2:42 PM, Sam Clauw wrote: > I have a problem with my file upload validation in CakePHP. > > When I add a new record with an image upload field... > >- ... image should be required. >- ... image file extension sould be jpg, png or gif. > > When I edit an existing record with an image upload field... > >- ... image is not required. >- ... when image is choosen: image file extension sould be jpg, png or >gif. > > Here's my best model code attempt so far: > > > > class Outlet extends CoasterCmsAppModel > { > public $validate = array( > 'name' => array( > 'rule' => 'notEmpty', // verplicht > 'message' => 'Name is required.', > 'allowEmpty' => true > ), > 'intro' => array( > 'rule' => 'notEmpty', // verplicht > 'message' => 'Intro is required.' > ), > 'photo' => array( > 'validFileSize' => array( // zelf gekozen naam van de regel > 'rule' => array('filesize', '>', 0), // verplicht > 'on' => 'create', > 'message' => 'Photo is required.' > ), > 'validExtension' => array( // zelf gekozen naam van de regel > 'rule' => array('extension', array('jpg', 'jpeg', 'png', > 'gif')), > 'on' => 'create', > 'message' => 'Photo has to contain a valid extension > (jpg, jpeg, png or gif).' > ), > 'validExtension' => array( // zelf gekozen naam van de regel > 'rule' => array('extension', array('jpg', 'jpeg', 'png', > 'gif')), > 'allowEmpty' => true, > 'on' => 'update', > 'message' => 'Photo has to contain a valid extension > (jpg, jpeg, png or gif).' > ) > ) > ); > > public function afterValidate() > { > $filename = $this->data['Outlet']['photo']['name']; > > if (!empty($filename)) { > move_uploaded_file($this->data['Outlet']['photo']['tmp_name'], > WWW_ROOT . 'img' . DS . 'outlets' . DS . $filename); > > $this->set('photo', $filename); > } else { > unset($this->data['Outlet']['photo']); > } > } > } > > > The "add" validation works fine for me. But strange as it is, when I edit > a record, I keep getting the error message "Photo has to contain a valid > extension (jpg, jpeg, png or gif)." > Somebody who can help me out of this? ;) > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
File upload validation
I have a problem with my file upload validation in CakePHP. When I add a new record with an image upload field... - ... image should be required. - ... image file extension sould be jpg, png or gif. When I edit an existing record with an image upload field... - ... image is not required. - ... when image is choosen: image file extension sould be jpg, png or gif. Here's my best model code attempt so far: array( 'rule' => 'notEmpty', // verplicht 'message' => 'Name is required.', 'allowEmpty' => true ), 'intro' => array( 'rule' => 'notEmpty', // verplicht 'message' => 'Intro is required.' ), 'photo' => array( 'validFileSize' => array( // zelf gekozen naam van de regel 'rule' => array('filesize', '>', 0), // verplicht 'on' => 'create', 'message' => 'Photo is required.' ), 'validExtension' => array( // zelf gekozen naam van de regel 'rule' => array('extension', array('jpg', 'jpeg', 'png', 'gif')), 'on' => 'create', 'message' => 'Photo has to contain a valid extension (jpg, jpeg, png or gif).' ), 'validExtension' => array( // zelf gekozen naam van de regel 'rule' => array('extension', array('jpg', 'jpeg', 'png', 'gif')), 'allowEmpty' => true, 'on' => 'update', 'message' => 'Photo has to contain a valid extension (jpg, jpeg, png or gif).' ) ) ); public function afterValidate() { $filename = $this->data['Outlet']['photo']['name']; if (!empty($filename)) { move_uploaded_file($this->data['Outlet']['photo']['tmp_name'], WWW_ROOT . 'img' . DS . 'outlets' . DS . $filename); $this->set('photo', $filename); } else { unset($this->data['Outlet']['photo']); } } } The "add" validation works fine for me. But strange as it is, when I edit a record, I keep getting the error message "Photo has to contain a valid extension (jpg, jpeg, png or gif)." Somebody who can help me out of this? ;) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
File upload failure to cakephp
Hi Grourp, I m newbie to the CakePHP, trying to upload xlsx file to CakePHP Below is my view code Form->create('Program', array('action' => 'importexcel', 'type' => 'file')); echo $this->Form->file('Document'); echo $this->Form->submit(__('Upload', true)); ?> And below is my Controller code to print array for to check. Later i would like to use the output of the array to perform upload using PHPExcel. public function importexcel() { if (isset($this->data)) { echo 'DATA:'; var_dump($this->data); echo 'FILES:'; var_dump($_FILES); } } Output of the controller is as below DATA: *array* 'Program' => *array* 'Document' => string 'import.xlsx' *(length=11)* FILES: *array* *empty* I need to get the properties, data of the $this->data in the controller so that i can use them in IOFactory of PHPExcel for uploading. Can someone please help me correct my view/controller code. Thank you very much. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakePHP 3 - Need File upload example
move_uploaded_file() should be used On Thursday, December 11, 2014 5:50:35 PM UTC+1, frocco wrote: > > Thanks, > > Do I just use PHP move_uploaded_file command or does CakePHP 3 have it's > own methods? > > > > On Thursday, December 11, 2014 9:04:24 AM UTC-5, José Lorenzo wrote: >> >> Create a form with a file input. Make sure that you call >> $this->Form->create($entity, ['file' => true]); when creating that form >> >> On Thursday, December 11, 2014 2:45:38 PM UTC+1, frocco wrote: >>> >>> Let me rephrase this. What do cakephp 3 users use for file upload? >>> >>> On Tuesday, December 9, 2014 9:17:18 AM UTC-5, frocco wrote: >>>> >>>> Hello, >>>> >>>> Can someone point me to a tutorial explaining this? >>>> >>>> Thanks >>>> >>> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakePHP 3 - Need File upload example
Thanks, Do I just use PHP move_uploaded_file command or does CakePHP 3 have it's own methods? On Thursday, December 11, 2014 9:04:24 AM UTC-5, José Lorenzo wrote: > > Create a form with a file input. Make sure that you call > $this->Form->create($entity, ['file' => true]); when creating that form > > On Thursday, December 11, 2014 2:45:38 PM UTC+1, frocco wrote: >> >> Let me rephrase this. What do cakephp 3 users use for file upload? >> >> On Tuesday, December 9, 2014 9:17:18 AM UTC-5, frocco wrote: >>> >>> Hello, >>> >>> Can someone point me to a tutorial explaining this? >>> >>> Thanks >>> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakePHP 3 - Need File upload example
Create a form with a file input. Make sure that you call $this->Form->create($entity, ['file' => true]); when creating that form On Thursday, December 11, 2014 2:45:38 PM UTC+1, frocco wrote: > > Let me rephrase this. What do cakephp 3 users use for file upload? > > On Tuesday, December 9, 2014 9:17:18 AM UTC-5, frocco wrote: >> >> Hello, >> >> Can someone point me to a tutorial explaining this? >> >> Thanks >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakePHP 3 - Need File upload example
Let me rephrase this. What do cakephp 3 users use for file upload? On Tuesday, December 9, 2014 9:17:18 AM UTC-5, frocco wrote: > > Hello, > > Can someone point me to a tutorial explaining this? > > Thanks > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
CakePHP 3 - Need File upload example
Hello, Can someone point me to a tutorial explaining this? Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: saveAssociated (deep) with file upload on deep model - looking for help (everything good except upload)
Just figured out the problem... The rules in my model, created by `cake bake`, although exactly what I would have wanted if I was manually uploading information and handling the data, don't work with the Upload plugin. It causes an error, which in turn doesn't let me upload the file. Had I uncommented or set a custom error message to be returned in the session, I probably would have figured it out sooner. I uncommented all of my TicketAttachment model validation rules just to see if it would work (it did). I'm going to go back and try adding some back in that don't directly relate to the upload process/data. But I won't be reporting back on that. For anyone else that may come across this topic - you can work a little bit on your own to figure things out too since this took me about 3.5 weeks all in total, just for getting files to upload through saveAssociated. :D ...upgrading my legacy app from 2.1 to 2.5 is not yet complete, so that's another amount of time I'll get to "play". :D Anyway, thanks to any one who looked at this in order to see if I needed help (and they thought they might be able to offer some). Thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: saveAssociated (deep) with file upload on deep model - looking for help (everything good except upload)
Sorry, correction: Currently running CakePHP v2.5.4 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
saveAssociated (deep) with file upload on deep model - looking for help (everything good except upload)
So I've managed to get saveAssociated to work as intended with option 'deep' => true, based on the Book's model requirements for this method I was able to construct the View properly (took me awhile). As of now, if I change the form's file fields to standard text fields, everything works as expected and all records are saved. As soon as I change those form fields to file fields, it breaks. I've tried using Miles Johnson's (now deprecated) Uploader plugin without success. After that didn't work I am now trying to get Jose Gonzalez's Upload plugin to work (github.com/josegonzalez/cakephp-upload). Unfortunately I'm coming across the same exact problem. My primary application is rather large, but due to the issues I've had, I created a new project with only the required models and fields needed to get a very simple solution working. For that test solution (everything working except upload), the following is how it is configured. MODELS: Ticket -> hasMany TicketResponse TicketResponse -> belongsTo Ticket -> hasMany TicketAttachment TicketAttachment -> belongsTo TicketResponse Ticket fields: id, title, created TicketResponse fields: id, ticket_id, created, content TicketAttachment fields: id, ticket_response_id, filename, location, filesize Files for Recreation of App (if helpful) DB schema: http://pastebin.com/XuwSCnHp Models: Ticket: http://pastebin.com/xRvU7Hhk TicketResponse: http://pastebin.com/1CvdA68w TicketAttachment: http://pastebin.com/xSajRhJD All of the controllers/views/models were originally created from the cake bake template. The only changes were to the models (fixing associations for saveAssociated to work, plugin/behavior settings, validation changes), the Ticket view add.ctp, and the ticket controller. Ticket View "add.ctp": http://pastebin.com/sSxh7Wps TicketController.php: http://pastebin.com/2n2jVtpg (NOTE: The Upload plugin would also need to be downloaded and configured (bootstrap.php), and the Session Component and Helper would need to be added to AppController as well. I'm running CakePHP v2.5.3 on this example project. I've upgraded my older project from 2.1 in order to try to solve my problems, but nothing seems to be working with regard to the upload. :( Also, I have a CakeLog::write call in the TicketAttachment model file. I *believe* the method calling that should be called from the Upload behavior, but it's never reached. In fact, I tried a CakeLog::write from within the Upload behavior's `setup()` method and it too did not write anything to the debug log. I'm stumped. I don't know if the Upload behavior just isn't loading properly, or if I've done something else improperly. After changing the text fields to file upload fields, the form just isn't saving, providing only the generic message that the ticket could not be saved. Before switching from the Uploader behavior to the Upload behavior, when I switched from text to file upload fields I was getting an error that a field of type array was an incorrect value (or something along those lines), so I *suspect* that the Upload behavior is loaded and instantiated, but I do not know how to properly validate this theory. Any help would be greatly appreciated! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: file upload
Do you mean you're trying to initiate a file download on click? Can you provide some code snippets so we can help further, the error you've shared only shows that it's trying to render a view or layout that doesn't exist. On 23 July 2014 12:45, Eric Yullu wrote: > created an application that is utlizing file upload, but when i click > download button i get error, media.ctp not found > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
file upload
created an application that is utlizing file upload, but when i click download button i get error, media.ctp not found -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
(how to prevent duplicate or same csv file upload into database in cake php?)Upload csv file to mssql server using cake php
hi everyone, i was trying to search for the code on how to prevent the duplicate data upload into my database system. one of the method is to set unique key for my data - time, that means everytime the data come in will search for different time, if detected same time it will unable the data upload. but i'm not sure how to start, i'm new to cake php. hope someone will guide me, thank you. is it need to set validate to model.php? and how to set the action on the controller for retrieve unique key for upload data? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: File Upload Err..
Analog other file formats Vào 14:21:48 UTC+7 Thứ ba, ngày 18 tháng hai năm 2014, Nguyen Cuong đã viết: > > I usually upload the file using the following method : > In the file controlller PostsController : > public function add(){ > $this->layout = false; > if($this->request->is('post')){ > $date = getdate(); > $name_img = > 'img-'.$date['hours'].$date['minutes'].$date['seconds'].'-'.$date['mday']. > $date['mon'].$date['year']; > $img_upload = $this->Uploader->upload('image', > array('overwrite' =>true,'name' =>$name_img)); > $this->request->data['Post']['image'] = > $img_upload['path']; > $this->Post->create(); > $this->Post->save($this->request->data); > //return $this->redirect(array('action'=>'index')); > } > > > } > file view add.ctp: > echo $this->Form->create('Post',array('type' => 'file')); > echo > $this->Form->input('Post.image',array('type'=>'file','label'=>'Image')); > echo $this->Form->end(' Add '); > ?> > > Database exist table posts : id, image(varchar(255))... > This will be somewhat helpful for you. Also you need to Uploader Plugin > installed correctly. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: File Upload Err..
I usually upload the file using the following method : In the file controlller PostsController : public function add(){ $this->layout = false; if($this->request->is('post')){ $date = getdate(); $name_img = 'img-'.$date['hours'].$date['minutes'].$date['seconds'].'-'.$date['mday']. $date['mon'].$date['year']; $img_upload = $this->Uploader->upload('image', array('overwrite' =>true,'name' =>$name_img)); $this->request->data['Post']['image'] = $img_upload['path']; $this->Post->create(); $this->Post->save($this->request->data); //return $this->redirect(array('action'=>'index')); } } file view add.ctp: Form->create('Post',array('type' => 'file')); echo $this->Form->input('Post.image',array('type'=>'file','label'=>'Image')); echo $this->Form->end(' Add '); ?> Database exist table posts : id, image(varchar(255))... This will be somewhat helpful for you. Also you need to Uploader Plugin installed correctly. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: File Upload Tutorial
Boss! Keith =) kindly post a 'download link' here in this tutorial. because it's really weary for me to read than to analyse.. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: File Upload Tutorial
is there somewhere I can download this source code? because there is no way that I make it throu this tutorial without making a billeon mistakes that make me scream an bash my laptop against the wall... would be really nice of you if you could publish the sourcecode. thx -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Implementing jQuery File Upload in CakePHP 2.1.x
I need integrate the Plugin with one Model. any idea? Em sábado, 28 de abril de 2012 08h46min59s UTC-3, Hugo Dias escreveu: > > Changed the source code for a single plugin . Now much easy to implement. >> > > Link: https://github.com/hugodias/FileUpload > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Multiple file upload
Hi David, Can you upload some examples of you approach to this? Thanks! Em sexta-feira, 26 de agosto de 2011 08h13min02s UTC-3, David Cole escreveu: > > I would recommend using SWFUpload and setting up an attachment > controller and behavior. This way you can have swfupload send the > files to a function in your controller. Then use the behavior to > create HABTM associations on the fly to your other models. It's what > I've done and it works great. If you need more details let me know, I > can send you the code. > > On Aug 23, 9:37 pm, 8vius wrote: > > I'm really struggling to find a solution for what I want to do. I want > > to be able to upload several image files simultaneously but I don't > > want to have several file boxes but just one where the user can select > > several files to upload, what is the best plugin and solution on the > > frontend side to do this? -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: HTTPSocket POST file upload problem
Okay, I have just successfully transferred the file from the remote server to my server using cURL by first authenticating, saving a cookie and then sending another request for the file. I'll proceed with my project using this method unless I get any feedback relating to my issue with HTTPSocket. On Saturday, 18 August 2012 08:39:24 UTC+1, Stuart Bridger wrote: > I am having problems uploading files from a remote server. Some of the > files download fine but others are incomplete. Strangely, the incomplete > files are always exactly the same length but I get unexpected end of file > when uncompressing them using gzip. > > $httpSocket = new HttpSocket(); >> $zipFile = fopen(TMP . 'tmp_file.gz', 'w'); >> >> $httpSocket->setContentResource($zipFile); >> $fileResponse = $httpSocket->get('URL_to_file', array(), array('redirect' >> => true)); >> >> fclose($zipFile); >> > > The URL redirects to an Amazon S3 bucket. > > Is there any way of checking if this is a problem at my end? Looked in > Apache and PHP error logs but can see nothing relevant. > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: HTTPSocket POST file upload problem
I have tried using Wireshark to figure out the problem and it appears that the communication is fine for a while and then my server sends an SSL alert 21 which means that a packet could not be decrypted. After this my server starts sending reset requests which are ignored by the remote server. On Saturday, 18 August 2012 08:39:24 UTC+1, Stuart Bridger wrote: > > I am having problems uploading files from a remote server. Some of the > files download fine but others are incomplete. Strangely, the incomplete > files are always exactly the same length but I get unexpected end of file > when uncompressing them using gzip. > > $httpSocket = new HttpSocket(); >> $zipFile = fopen(TMP . 'tmp_file.gz', 'w'); >> >> $httpSocket->setContentResource($zipFile); >> $fileResponse = $httpSocket->get('URL_to_file', array(), array('redirect' >> => true)); >> >> fclose($zipFile); >> > > The URL redirects to an Amazon S3 bucket. > > Is there any way of checking if this is a problem at my end? Looked in > Apache and PHP error logs but can see nothing relevant. > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
HTTPSocket POST file upload problem
I am having problems uploading files from a remote server. Some of the files download fine but others are incomplete. Strangely, the incomplete files are always exactly the same length but I get unexpected end of file when uncompressing them using gzip. $httpSocket = new HttpSocket(); > $zipFile = fopen(TMP . 'tmp_file.gz', 'w'); > > $httpSocket->setContentResource($zipFile); > $fileResponse = $httpSocket->get('URL_to_file', array(), array('redirect' > => true)); > > fclose($zipFile); > The URL redirects to an Amazon S3 bucket. Is there any way of checking if this is a problem at my end? Looked in Apache and PHP error logs but can see nothing relevant. -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Form file upload problem
*Did you use the enctype for post media data?* On Thursday, July 12, 2012 1:00:24 PM UTC+5:30, technobulka wrote: > > create input file: >> >> $this->Form->file('color.'.$prod_color['id'].'.images.'.$i) >> > > in html i see: > >> data[color][1][images][0] > > ... > > data[color][1][images][9] > > > but debug($this->data['color']) looks like: > >> Array >> ( >> [1] => Array >> ( >> [images] => Array >> ( >> [name] => Array >> ( >> [0] => >> >> ... >> >> [9] => ) [type] => Array ( [0] => >> >> ... >> >> [9] => ) [tmp_name] => Array ( [0] => >> >> ... >> >> [9] => ) [error] => Array ( [0] => 4 >> >> ... >> >> [9] => 4 ) [size] => Array ( [0] => 0 >> >> ... >> >> [9] => 0 ) ) ) [2] => Array ( ... >> >> > what i do wrong? why it don't create normal array? > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Form file upload problem
create input file: > > $this->Form->file('color.'.$prod_color['id'].'.images.'.$i) > in html i see: > data[color][1][images][0] ... data[color][1][images][9] but debug($this->data['color']) looks like: > Array > ( > [1] => Array > ( > [images] => Array > ( > [name] => Array > ( > [0] => > > ... > > [9] => ) [type] => Array ( [0] => > > ... > > [9] => ) [tmp_name] => Array ( [0] => > > ... > > [9] => ) [error] => Array ( [0] => 4 > > ... > > [9] => 4 ) [size] => Array ( [0] => 0 > > ... > > [9] => 0 ) ) ) [2] => Array ( ... > > what i do wrong? why it don't create normal array? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload problem
I discovered that the problem in Firefox. It does not allow uploading bigger than 450 KB in total. For all other browsers all is OK. Unbelievable! Thanks! On 15 lip, 20:12, lowpass wrote: > Read this section:http://www.php.net/manual/en/features.file-upload.php > > If your form has a hidden MAX_FILE_SIZE input check the value. > > Also, if you are using some javascript to handle the uploads, make > sure it doesn't impose its own size limit. > > > > > > > > On Fri, Jun 15, 2012 at 8:06 AM, zoran wrote: > > I'm trying to 3 files at once transferred to the server. If the size of > > individual images exceed 200kb I can not transfer them to the server and I > > could not get the value of print print_r (). > > What would be problem? > > Width smaller images no problems. Everything is happening before validating > > input. > > This is my code: > > > function admin_add() { > > > if (empty($this->data)) { > > $this->render(); > > } else { > > > print_r($this->data); > > exit; > > > //SOMETHING TO DO . > > > } > > } > > > This is print for smaller images: > > Array > > ( > > [HotelPhoto] => Array > > ( > > [file1] => Array > > ( > > [name] => soba_auta_550.jpg > > [type] => image/jpeg > > [tmp_name] => /tmp/phpBiAuJH > > [error] => 0 > > [size] => 43615 > > ) > > > [file2] => Array > > ( > > [name] => soba_crvena_550.jpg > > [type] => image/jpeg > > [tmp_name] => /tmp/phphie46O > > [error] => 0 > > [size] => 46465 > > ) > > > [file3] => Array > > ( > > [name] => soba_zelena_550.jpg > > [type] => image/jpeg > > [tmp_name] => /tmp/phpymXGuW > > [error] => 0 > > [size] => 25432 > > ) > > > ) > > > ) > > > I can't get same result for larger photos. Why ??? > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > >http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload problem
Read this section: http://www.php.net/manual/en/features.file-upload.php If your form has a hidden MAX_FILE_SIZE input check the value. Also, if you are using some javascript to handle the uploads, make sure it doesn't impose its own size limit. On Fri, Jun 15, 2012 at 8:06 AM, zoran wrote: > I'm trying to 3 files at once transferred to the server. If the size of > individual images exceed 200kb I can not transfer them to the server and I > could not get the value of print print_r (). > What would be problem? > Width smaller images no problems. Everything is happening before validating > input. > This is my code: > > function admin_add() { > > if (empty($this->data)) { > $this->render(); > } else { > > print_r($this->data); > exit; > > //SOMETHING TO DO . > > } > } > > This is print for smaller images: > Array > ( > [HotelPhoto] => Array > ( > [file1] => Array > ( > [name] => soba_auta_550.jpg > [type] => image/jpeg > [tmp_name] => /tmp/phpBiAuJH > [error] => 0 > [size] => 43615 > ) > > [file2] => Array > ( > [name] => soba_crvena_550.jpg > [type] => image/jpeg > [tmp_name] => /tmp/phphie46O > [error] => 0 > [size] => 46465 > ) > > [file3] => Array > ( > [name] => soba_zelena_550.jpg > [type] => image/jpeg > [tmp_name] => /tmp/phpymXGuW > [error] => 0 > [size] => 25432 > ) > > ) > > ) > > I can't get same result for larger photos. Why ??? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
File upload problem
I'm trying to 3 files at once transferred to the server. If the size of individual images exceed 200kb I can not transfer them to the server and I could not get the value of print print_r (). What would be problem? Width smaller images no problems. Everything is happening before validating input. This is my code: function admin_add() { if (empty($this->data)) { $this->render(); } else { print_r($this->data); exit; //SOMETHING TO DO . } } This is print for smaller images: Array ( [HotelPhoto] => Array ( [file1] => Array ( [name] => soba_auta_550.jpg [type] => image/jpeg [tmp_name] => /tmp/phpBiAuJH [error] => 0 [size] => 43615 ) [file2] => Array ( [name] => soba_crvena_550.jpg [type] => image/jpeg [tmp_name] => /tmp/phphie46O [error] => 0 [size] => 46465 ) [file3] => Array ( [name] => soba_zelena_550.jpg [type] => image/jpeg [tmp_name] => /tmp/phpymXGuW [error] => 0 [size] => 25432 ) ) ) I can't get same result for larger photos. Why ??? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP (2.1) Media Plugin - Multi File Upload
Just thought I'd post my slightly cleaner solution to this which makes use of a modified version of the attachments element in the media plugin. This allows you to use the attachment multiple times in a form for when you have different groups of attachments i.e. photos, files, videos etc. I'm no programmer, just a designer so there's probably a better way to do it but I don't know it :) To save me editing too much I'll just use my example of a ProjectProfile model: ProjectProfile.php > array( 'className' => 'Project', 'foreignKey' => 'pjID' //'conditions' => '', //'fields' => '', //'order' => '' ) ); var $hasMany = array( 'Photo' => array( 'className' => 'Media.Attachment', 'order' => 'Photo.basename, Photo.id', 'foreignKey' => 'foreign_key', 'conditions' => array('Photo.model' => 'ProjectProfile', 'Photo.group' => 'Photo'), 'dependent' => true), 'Attachment' => array( 'className' => 'Media.Attachment', 'order' => 'Attachment.basename, Attachment.id', 'foreignKey' => 'foreign_key', 'conditions' => array('Attachment.model' => 'ProjectProfile', 'Attachment.group' => 'Attachment'), 'dependent' => true) ); } ProjectProfilesControler.php > ProjectProfile->id = $id; if (!$this->ProjectProfile->exists()) { throw new NotFoundException(__('Invalid project profile')); } if ($this->request->is('post') || $this->request->is('put')) { //convert cakephp html5 file upload data array to media plugin required format $model = Inflector::classify($this->params['controller']); foreach ($this->request->data[$model]['assocAlias'] as $assocAlias) { $i = 0; foreach ($this->request->data[$model][$assocAlias.'files'] as $file) { $this->set($this->request->data[$assocAlias][$i]['model'] = $model); $this->set($this->request->data[$assocAlias][$i]['group'] = strtolower($assocAlias)); $this->set($this->request->data[$assocAlias][$i]['file'] = $this->request->data[$model][$assocAlias.'files'][$i]); $i++; } } if ($this->ProjectProfile->saveAll($this->request->data)) { $this->Session->setFlash(__('The project profile has been saved')); $this->redirect(array('action' => 'admin_edit', $id)); } else { $this->Session->setFlash(__('The project profile could not be saved. Please, try again.')); } } else { $this->request->data = $this->ProjectProfile->read(null, $id); } $projects = $this->ProjectProfile->Project->find('list', array('fields' => array('Project.pjID', 'Project.pntitle'))); $this->set(compact('projects')); } ?> Then in the view/form: admin_edit.php > Form->create('ProjectProfile', array('type'=>'file'));?> Form->input('id'); echo $this->Form->input('pjID', array('label' => 'Project', 'options' => $projects)); echo $this->Form->input('description'); echo $this->Form->input('longitude'); echo $this->Form->input('latitude');
Re: CakePHP (2.1) Media Plugin - Multi File Upload
Well this whole project has made me realise how much I suck at Ajax/JS etc. I ended up getting this working using cakephp's HTML5 multi file support and converting that data array to one that the media plugin would understand (as per Jeremy's first suggestion!). In case anybody else is looking to do this... In the view add to your form: echo $this->Form->input('files.', array('type' => 'file', 'multiple')); So that'll allow you to select multiple files. In the controller do something like: $i = 0; foreach ($this->request->data['Model']['files'] as $file) { $this->set($this->request->data['Photo'][$i]['model'] = 'Model'); $this->set($this->request->data['Photo'][$i]['group'] = 'group'); $this->set($this->request->data['Photo'][$i]['file'] = $this->request- >data['Model']['files'][$i]); $i++; } Then make sure you have saveAll: if ($this->Model->saveAll($this->request->data)) { ... I'm going to spend some time sorting it out better and making it as reusable as possible. This solution is good for me as it's for an intranet site so I have control over what browser people are using. And if the users's browser doesn't support html5 then they can still upload, just one file at a time. Thanks for your suggestions Jeremy. On May 1, 11:27 pm, jeremyharris wrote: > I don't have any templates, but I use file-uploader[1] on a currently > active project. It doesn't require jQuery but works pretty nicely. > > It sends each upload as a separate request, so write the controller code as > if you're receiving one file (like the media plugin examples) and you > should be good. This method is preferred, because when javascript is > disabled the logic in the controller doesn't need to change will still work > (i.e., old school single upload). > > 1:https://github.com/valums/file-uploader (doesn't seem to be maintained > by the author but there are numerous forks) > > > > > > > > On Monday, April 30, 2012 8:09:33 PM UTC-7, double07 wrote: > > Hi Jeremy, > > > Not having much luck with the saving manually option, do you having > > any working examples of drag and drop (jquery) I can look at? > > > Thanks, > > > -Brett > > > On Apr 17, 7:44 am, jeremyharris wrote: > > > > Or, instead of using the multiple option, you can try processing them > > each > > > as a single request so you don't have to change anything in your > > controller > > > but rather just how the view presents it. I've used drag and drop jQuery > > > plugins and the like to help with this. It's by far my favorite > > solution, > > > because it doesn't rely on browser specific features (such as HTML5 > > > multiple upload). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP (2.1) Media Plugin - Multi File Upload
I don't have any templates, but I use file-uploader[1] on a currently active project. It doesn't require jQuery but works pretty nicely. It sends each upload as a separate request, so write the controller code as if you're receiving one file (like the media plugin examples) and you should be good. This method is preferred, because when javascript is disabled the logic in the controller doesn't need to change will still work (i.e., old school single upload). 1: https://github.com/valums/file-uploader (doesn't seem to be maintained by the author but there are numerous forks) On Monday, April 30, 2012 8:09:33 PM UTC-7, double07 wrote: > Hi Jeremy, > > Not having much luck with the saving manually option, do you having > any working examples of drag and drop (jquery) I can look at? > > Thanks, > > -Brett > > On Apr 17, 7:44 am, jeremyharris wrote: > > > > Or, instead of using the multiple option, you can try processing them > each > > as a single request so you don't have to change anything in your > controller > > but rather just how the view presents it. I've used drag and drop jQuery > > plugins and the like to help with this. It's by far my favorite > solution, > > because it doesn't rely on browser specific features (such as HTML5 > > multiple upload). > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP (2.1) Media Plugin - Multi File Upload
Hi Jeremy, Not having much luck with the saving manually option, do you having any working examples of drag and drop (jquery) I can look at? Thanks, -Brett On Apr 17, 7:44 am, jeremyharris wrote: > > Or, instead of using the multiple option, you can try processing them each > as a single request so you don't have to change anything in your controller > but rather just how the view presents it. I've used drag and drop jQuery > plugins and the like to help with this. It's by far my favorite solution, > because it doesn't rely on browser specific features (such as HTML5 > multiple upload). > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Implementing jQuery File Upload in CakePHP 2.1.x
> > Changed the source code for a single plugin . Now much easy to implement. > Link: https://github.com/hugodias/FileUpload -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Implementing jQuery File Upload in CakePHP 2.1.x
Hi, i'm trying to implement this plugin ( http://blueimp.github.com/jQuery-File-Upload/ ) in cakephp 2.1.x the best way possible. Here is the repository : https://github.com/hugodias/JqueryFileUpload-CakePHP its already done but now we need to review the code and let it clean as possible . thx :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP (2.1) Media Plugin - Multi File Upload
Sorry I never got notified of replies for some reason, I will try this looping method I think it could work. Thanks! On Apr 17, 7:44 am, jeremyharris wrote: > You could try looping through the files array and saving them manually: > > foreach $_FILES['files'] as $file { > // create data array containing fields such as a foreignKey, model, etc. > and save them as individual records > > } > > Or, instead of using the multiple option, you can try processing them each > as a single request so you don't have to change anything in your controller > but rather just how the view presents it. I've used drag and drop jQuery > plugins and the like to help with this. It's by far my favorite solution, > because it doesn't rely on browser specific features (such as HTML5 > multiple upload). > > > > > > > > On Sunday, April 15, 2012 5:42:25 PM UTC-7, double07 wrote: > > > Hi All, > > > I'm using the cakephp media plugin in my project using the monolithic > > style attachments table, i.e. all the attachments go in the one table > > with foreign_key, model, group etc. saved with the file details. So my > > model looks like: > > > class ProjectProfile extends AppModel { > > > var $name = 'ProjectProfile'; > > var $useDbConfig = 'default'; > > var $useTable = 'project_profiles'; > > var $actsAs = array('Media.Transfer', 'Media.Generator'); > > > public $belongsTo = array( > > 'Project' => array( > > 'className' => 'Project', > > 'foreignKey' => 'pjID' > > ) > > ); > > > var $hasMany = array( > > 'Photo' => array( > > 'className' => 'Media.Attachment', > > 'order' => 'Photo.basename, Photo.id', > > 'foreignKey' => 'foreign_key', > > 'conditions' => array('Photo.model' => 'ProjectProfile', > > 'Photo.group' => 'Photo'), > > 'dependent' => true) > > ); > > > Then a saveAll in the controller when saving my record saves the > > attached file(s). > > > This all works fine, however I'd really like to be able to upload > > multiple files at once, which the plugin does support by doing this in > > the form: > > > echo $this->Form->hidden('Photo.0.model', array('value' => 'Photo')); > > echo $this->Form->input('Photo.0.file', array('type' => 'file'); > > echo $this->Form->hidden('Photo.1.model', array('value' => 'Photo')); > > echo $this->Form->input('Photo.1.file', array('type' => 'file'); > > echo $this->Form->hidden('Photo.2.model', array('value' => 'Photo')); > > echo $this->Form->input('Photo.2.file', array('type' => 'file'); > > > But I think you'd agree that's a bit cumbersome to have to click > > browse for each individual file. The simplist method I could see to to > > allow multiple file uploads was to use the HTML5 multiple file section > > option - > >http://bakery.cakephp.org/articles/veganista/2012/01/31/html_5_multip... > > : > > > echo $this->Form->input('files.', array('type' => 'file', > > 'multiple')); > > > This allows you to shift click in the file browser to select multiple > > files then puts the files into an array to save... however, this field > > format isn't handled by the media plugin. Also, there'd be no way to > > add the model, group etc. fields on the save as far as I could see. > > > So, does anybody know how I can handle multi file uploads with the > > media plugin using the monolithic model? I'm open to all suggestions. > > > Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP (2.1) Media Plugin - Multi File Upload
You could try looping through the files array and saving them manually: foreach $_FILES['files'] as $file { // create data array containing fields such as a foreignKey, model, etc. and save them as individual records } Or, instead of using the multiple option, you can try processing them each as a single request so you don't have to change anything in your controller but rather just how the view presents it. I've used drag and drop jQuery plugins and the like to help with this. It's by far my favorite solution, because it doesn't rely on browser specific features (such as HTML5 multiple upload). On Sunday, April 15, 2012 5:42:25 PM UTC-7, double07 wrote: > > Hi All, > > I'm using the cakephp media plugin in my project using the monolithic > style attachments table, i.e. all the attachments go in the one table > with foreign_key, model, group etc. saved with the file details. So my > model looks like: > > class ProjectProfile extends AppModel { > > var $name = 'ProjectProfile'; > var $useDbConfig = 'default'; > var $useTable = 'project_profiles'; > var $actsAs = array('Media.Transfer', 'Media.Generator'); > > public $belongsTo = array( > 'Project' => array( > 'className' => 'Project', > 'foreignKey' => 'pjID' > ) > ); > > var $hasMany = array( > 'Photo' => array( > 'className' => 'Media.Attachment', > 'order' => 'Photo.basename, Photo.id', > 'foreignKey' => 'foreign_key', > 'conditions' => array('Photo.model' => 'ProjectProfile', > 'Photo.group' => 'Photo'), > 'dependent' => true) > ); > > Then a saveAll in the controller when saving my record saves the > attached file(s). > > This all works fine, however I'd really like to be able to upload > multiple files at once, which the plugin does support by doing this in > the form: > > echo $this->Form->hidden('Photo.0.model', array('value' => 'Photo')); > echo $this->Form->input('Photo.0.file', array('type' => 'file'); > echo $this->Form->hidden('Photo.1.model', array('value' => 'Photo')); > echo $this->Form->input('Photo.1.file', array('type' => 'file'); > echo $this->Form->hidden('Photo.2.model', array('value' => 'Photo')); > echo $this->Form->input('Photo.2.file', array('type' => 'file'); > > But I think you'd agree that's a bit cumbersome to have to click > browse for each individual file. The simplist method I could see to to > allow multiple file uploads was to use the HTML5 multiple file section > option - > http://bakery.cakephp.org/articles/veganista/2012/01/31/html_5_multiple_file_upload_with_cake > > : > > echo $this->Form->input('files.', array('type' => 'file', > 'multiple')); > > This allows you to shift click in the file browser to select multiple > files then puts the files into an array to save... however, this field > format isn't handled by the media plugin. Also, there'd be no way to > add the model, group etc. fields on the save as far as I could see. > > So, does anybody know how I can handle multi file uploads with the > media plugin using the monolithic model? I'm open to all suggestions. > > Thanks in advance. > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP (2.1) Media Plugin - Multi File Upload
Try MeioUpload. https://github.com/jrbasso/MeioUpload 2012/4/15 double07 > Hi All, > > I'm using the cakephp media plugin in my project using the monolithic > style attachments table, i.e. all the attachments go in the one table > with foreign_key, model, group etc. saved with the file details. So my > model looks like: > > class ProjectProfile extends AppModel { > > var $name = 'ProjectProfile'; > var $useDbConfig = 'default'; > var $useTable = 'project_profiles'; > var $actsAs = array('Media.Transfer', 'Media.Generator'); > > public $belongsTo = array( >'Project' => array( >'className' => 'Project', >'foreignKey' => 'pjID' >) > ); > > var $hasMany = array( > 'Photo' => array( > 'className' => 'Media.Attachment', > 'order' => 'Photo.basename, Photo.id', > 'foreignKey' => 'foreign_key', > 'conditions' => array('Photo.model' => 'ProjectProfile', > 'Photo.group' => 'Photo'), > 'dependent' => true) > ); > > Then a saveAll in the controller when saving my record saves the > attached file(s). > > This all works fine, however I'd really like to be able to upload > multiple files at once, which the plugin does support by doing this in > the form: > > echo $this->Form->hidden('Photo.0.model', array('value' => 'Photo')); > echo $this->Form->input('Photo.0.file', array('type' => 'file'); > echo $this->Form->hidden('Photo.1.model', array('value' => 'Photo')); > echo $this->Form->input('Photo.1.file', array('type' => 'file'); > echo $this->Form->hidden('Photo.2.model', array('value' => 'Photo')); > echo $this->Form->input('Photo.2.file', array('type' => 'file'); > > But I think you'd agree that's a bit cumbersome to have to click > browse for each individual file. The simplist method I could see to to > allow multiple file uploads was to use the HTML5 multiple file section > option - > http://bakery.cakephp.org/articles/veganista/2012/01/31/html_5_multiple_file_upload_with_cake > : > > echo $this->Form->input('files.', array('type' => 'file', > 'multiple')); > > This allows you to shift click in the file browser to select multiple > files then puts the files into an array to save... however, this field > format isn't handled by the media plugin. Also, there'd be no way to > add the model, group etc. fields on the save as far as I could see. > > So, does anybody know how I can handle multi file uploads with the > media plugin using the monolithic model? I'm open to all suggestions. > > Thanks in advance. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Paulo de Almeida Linux User #494076 Ubuntu User # 28289 "In a world without walls who needs windows and gates?" -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakePHP (2.1) Media Plugin - Multi File Upload
Hi All, I'm using the cakephp media plugin in my project using the monolithic style attachments table, i.e. all the attachments go in the one table with foreign_key, model, group etc. saved with the file details. So my model looks like: class ProjectProfile extends AppModel { var $name = 'ProjectProfile'; var $useDbConfig = 'default'; var $useTable = 'project_profiles'; var $actsAs = array('Media.Transfer', 'Media.Generator'); public $belongsTo = array( 'Project' => array( 'className' => 'Project', 'foreignKey' => 'pjID' ) ); var $hasMany = array( 'Photo' => array( 'className' => 'Media.Attachment', 'order' => 'Photo.basename, Photo.id', 'foreignKey' => 'foreign_key', 'conditions' => array('Photo.model' => 'ProjectProfile', 'Photo.group' => 'Photo'), 'dependent' => true) ); Then a saveAll in the controller when saving my record saves the attached file(s). This all works fine, however I'd really like to be able to upload multiple files at once, which the plugin does support by doing this in the form: echo $this->Form->hidden('Photo.0.model', array('value' => 'Photo')); echo $this->Form->input('Photo.0.file', array('type' => 'file'); echo $this->Form->hidden('Photo.1.model', array('value' => 'Photo')); echo $this->Form->input('Photo.1.file', array('type' => 'file'); echo $this->Form->hidden('Photo.2.model', array('value' => 'Photo')); echo $this->Form->input('Photo.2.file', array('type' => 'file'); But I think you'd agree that's a bit cumbersome to have to click browse for each individual file. The simplist method I could see to to allow multiple file uploads was to use the HTML5 multiple file section option - http://bakery.cakephp.org/articles/veganista/2012/01/31/html_5_multiple_file_upload_with_cake : echo $this->Form->input('files.', array('type' => 'file', 'multiple')); This allows you to shift click in the file browser to select multiple files then puts the files into an array to save... however, this field format isn't handled by the media plugin. Also, there'd be no way to add the model, group etc. fields on the save as far as I could see. So, does anybody know how I can handle multi file uploads with the media plugin using the monolithic model? I'm open to all suggestions. Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
I really like the MeioUpload plugin: https://github.com/jrbasso/MeioUpload Att., -- ***Thiago Belem* Desenvolvedor Rio de Janeiro - RJ - Brasil +55 (21) 8865.9250 thiagobelem.net cont...@thiagobelem.net *Skype / gTalk **»* thiago.belem.web *LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt* Assando Sites*, curso de CakePHP *»* assando-sites.com.br 2012/1/25 Sam Sherlock > Yep I agree the media plugin is amazing and vast (not for all because of > that) > assuming your using cake 2.0 I would not use the media plugin > > I just had a short play with Miles J uploadeder (copyied the example from > inside the plugin into a test app) > the files the uploader moves to WEBROOT/files always empty (I did not get > to investigating this as yet) > > Cakepackages lists a few plugins [1] for uploading files with cake. I > recall Nick Bakers plugin > being really easy to setup with 1.2/1.3 [2] is a link to the 2.0 version I > have not tried that as yet > > 1) http://cakepackages.com/packages/index/query:upload > 2) > https://github.com/webtechnick/CakePHP-FileUpload-Plugin/tree/cakephp2.0 > > > - S > > > > > On 25 January 2012 18:01, jeremyharris wrote: > >> The media plugin (https://github.com/davidpersson/media) is certainly >> the most powerful one I've found, although it's lacking in documentation >> and getting started can be a bit of a task. Once you wrap your head around >> it, it's really solid and does quite a bit. >> >> -- >> Our newest site for the community: CakePHP Video Tutorials >> http://tv.cakephp.org >> Check out the new CakePHP Questions site http://ask.cakephp.org and help >> others with their CakePHP related questions. >> >> >> To unsubscribe from this group, send email to >> cake-php+unsubscr...@googlegroups.com For more options, visit this group >> at http://groups.google.com/group/cake-php >> > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
Yep I agree the media plugin is amazing and vast (not for all because of that) assuming your using cake 2.0 I would not use the media plugin I just had a short play with Miles J uploadeder (copyied the example from inside the plugin into a test app) the files the uploader moves to WEBROOT/files always empty (I did not get to investigating this as yet) Cakepackages lists a few plugins [1] for uploading files with cake. I recall Nick Bakers plugin being really easy to setup with 1.2/1.3 [2] is a link to the 2.0 version I have not tried that as yet 1) http://cakepackages.com/packages/index/query:upload 2) https://github.com/webtechnick/CakePHP-FileUpload-Plugin/tree/cakephp2.0 - S On 25 January 2012 18:01, jeremyharris wrote: > The media plugin (https://github.com/davidpersson/media) is certainly the > most powerful one I've found, although it's lacking in documentation and > getting started can be a bit of a task. Once you wrap your head around it, > it's really solid and does quite a bit. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
The media plugin (https://github.com/davidpersson/media) is certainly the most powerful one I've found, although it's lacking in documentation and getting started can be a bit of a task. Once you wrap your head around it, it's really solid and does quite a bit. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
Allan, I am a noob to OOP & Cake, so only got the basic uploader working (without linking it to my db, this it was very straightforward). I think that Miles is a member of this group and he might help, if not, someone who is a real developer (like Sam or Euromark) are probably your best bet :) Sorry I can't add more than that. I'd be interested in seeing the solution too. Regards, Tim -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | On Tue, Jan 24, 2012 at 9:44 PM, Allan Cochrane wrote: > Hi Tim, > > did you get the Miles Johson Uploader plugin working? If so, how? I am a > relative noob to CakePHP and am having trouble working out from the > documentation the exact steps to take, especially when one model haMany > uploads, I can't work out what to put in the controller and what to put in > the two models! > > Any help appreciated. > > Thanks, > > Allan > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
Hi Tim, did you get the Miles Johson Uploader plugin working? If so, how? I am a relative noob to CakePHP and am having trouble working out from the documentation the exact steps to take, especially when one model haMany uploads, I can't work out what to put in the controller and what to put in the two models! Any help appreciated. Thanks, Allan -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
Jon, This was exactly what I was looking for! Thanks :) Tim -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | On Wed, Dec 28, 2011 at 7:09 PM, Jon Price wrote: > try this: http://milesj.me/code/cakephp/uploader > I'm using his autologin component but he has other code you might look > into. > > > On Wed, Dec 28, 2011 at 9:02 PM, Timothy O'Reilly < > timothy.john.orei...@gmail.com> wrote: > >> Thanks for responding. Was just hoping someone had a cool plugin (with >> features i havent yet thought of) that would save me writing it :) >> Will do! >> Tim > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
Thanks Jon. Will take a look. On Wednesday, December 28, 2011, Jon Price wrote: > try this: http://milesj.me/code/cakephp/uploader > I'm using his autologin component but he has other code you might look into. > > On Wed, Dec 28, 2011 at 9:02 PM, Timothy O'Reilly < timothy.john.orei...@gmail.com> wrote: >> >> Thanks for responding. Was just hoping someone had a cool plugin (with features i havent yet thought of) that would save me writing it :) >> Will do! >> Tim > > -- > Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php > -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | | web: www.zign.me | skype: timothy.o.reilly | twitter: @timothyjoreilly | -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
try this: http://milesj.me/code/cakephp/uploader I'm using his autologin component but he has other code you might look into. On Wed, Dec 28, 2011 at 9:02 PM, Timothy O'Reilly < timothy.john.orei...@gmail.com> wrote: > Thanks for responding. Was just hoping someone had a cool plugin (with > features i havent yet thought of) that would save me writing it :) > Will do! > Tim -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
Thanks for responding. Was just hoping someone had a cool plugin (with features i havent yet thought of) that would save me writing it :) Will do! Tim On Wednesday, December 28, 2011, Điển vũ wrote: > I think better you should use your script about uploading. Uploading is hard to write plugin use for all case. > And It is easier to change , or add new features, even update to 3.0 version ( in future ) , because script is yours . > > > -- > Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php > -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | | web: www.zign.me | skype: timothy.o.reilly | twitter: @timothyjoreilly | -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload Plugins
I think better you should use your script about uploading. Uploading is hard to write plugin use for all case. And It is easier to change , or add new features, even update to 3.0 version ( in future ) , because script is yours . -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
File Upload Plugins
Hi, Does anyone have a recommendation for a File Upload plugin for use with Cake Ver 2.0.4? I want to upload PDF documents, store them in a folder and have the URL location stored in my database/table. I have been playing with a bunch of scripts and started doing it from scratch, but of someone has done it and has a plugin that would be great... Thanks, Tim (No relation to the Publisher) -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How can I make this file upload javascript work in cakephp?
Barricades, welcome to the community! If you are so new to CakePHP and JavaScript then I would suggest sticking to plugins and helpers that other people within the community use, this way you are much more likely to get support. I certainly would not go and learn how to use the script above so I could then educate you on how to use it, but a quick Google search shows there are various existing image upload tools available for CakePHP along with tutorials on how to set them up: http://lmgtfy.com/?q=cakephp%3Dimage%2Bupload HTH, Paul. On Nov 5, 2:45 pm, barricades wrote: > I'm learning (trying to anyway) how to use cakephp, and I have a > little javascript which I'd like to use, but I'm having problems > figuring out how to make it work with cakephp. > > The javascript uploads a photo and displays it in a div elsewhere on > the page without reloading and makes it look like ajax. It uses a > hidden iframe. > > I think the problems I've having are to do with relative paths and > basically where to put everything. I've to admit I'm not much of a > programmer yet so it's probably something really simple I'm not doing > but the script doesn't have tutorial and like I said I'm new to cake. > > If anyone fancied helping me out by giving me a run through of what to > do I'd be really grateful. Talk to me like I know nothing, I know very > little :) Here's the script's > website:http://atwebresults.com/php_ajax_image_upload/ > > By the way, I know this might not be the best script on the 'net but > it does seem to do exactly what I want to do (vis-a-vis the preview) > and I'd like to get it working :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How can I make this file upload javascript work in cakephp?
I'm learning (trying to anyway) how to use cakephp, and I have a little javascript which I'd like to use, but I'm having problems figuring out how to make it work with cakephp. The javascript uploads a photo and displays it in a div elsewhere on the page without reloading and makes it look like ajax. It uses a hidden iframe. I think the problems I've having are to do with relative paths and basically where to put everything. I've to admit I'm not much of a programmer yet so it's probably something really simple I'm not doing but the script doesn't have tutorial and like I said I'm new to cake. If anyone fancied helping me out by giving me a run through of what to do I'd be really grateful. Talk to me like I know nothing, I know very little :) Here's the script's website: http://atwebresults.com/php_ajax_image_upload/ By the way, I know this might not be the best script on the 'net but it does seem to do exactly what I want to do (vis-a-vis the preview) and I'd like to get it working :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Multiple file upload
I would like the details of this, it's good to have another approach in case On Aug 26, 7:13 am, David Cole wrote: > I would recommend using SWFUpload and setting up an attachment > controller and behavior. This way you can have swfupload send the > files to a function in your controller. Then use the behavior to > create HABTM associations on the fly to your other models. It's what > I've done and it works great. If you need more details let me know, I > can send you the code. > > On Aug 23, 9:37 pm,8vius wrote: > > > > > > > > > I'm really struggling to find a solution for what I want to do. I want > > to be able to upload several image files simultaneously but I don't > > want to have several file boxes but just one where the user can select > > several files to upload, what is the best plugin and solution on the > > frontend side to do this? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Multiple file upload
I would recommend using SWFUpload and setting up an attachment controller and behavior. This way you can have swfupload send the files to a function in your controller. Then use the behavior to create HABTM associations on the fly to your other models. It's what I've done and it works great. If you need more details let me know, I can send you the code. On Aug 23, 9:37 pm, 8vius wrote: > I'm really struggling to find a solution for what I want to do. I want > to be able to upload several image files simultaneously but I don't > want to have several file boxes but just one where the user can select > several files to upload, what is the best plugin and solution on the > frontend side to do this? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Multiple file upload
Not really to sure I have not fiddled with the setup of media within my app for a while. I have the basics working of what I want from media now, planning to revisit later. transfer is working for me. for instance News hasMany Image > from news controller call find on Image (or attachments) using debugkit easily see the results and sql - to see that your getting what you want I have not tried with multiple uploads (other than the most simple) just searched for blog posts on the topic (with and without cake) I have found various other frontend options I would prefer - S On 24 August 2011 04:18, 8vius wrote: > Thanks Sam, this seems to be simple enough and that it will do the > trick, now how would I go about getting all the files I just uploaded > because the thing is these are not files that are independent they > will be linked to another model, for instance News hasMany Image > > On Aug 23, 10:47 pm, Sam Sherlock wrote: > > http://pixelcone.com/tutorial/ajax-file-upload-using-jquery-and-cakep... > > > > - S > > > > On 24 August 2011 03:37, 8vius wrote: > > > > > > > > > > > > > > > > > I'm really struggling to find a solution for what I want to do. I want > > > to be able to upload several image files simultaneously but I don't > > > want to have several file boxes but just one where the user can select > > > several files to upload, what is the best plugin and solution on the > > > frontend side to do this? > > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > group > > > athttp://groups.google.com/group/cake-php > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Multiple file upload
Thanks Sam, this seems to be simple enough and that it will do the trick, now how would I go about getting all the files I just uploaded because the thing is these are not files that are independent they will be linked to another model, for instance News hasMany Image On Aug 23, 10:47 pm, Sam Sherlock wrote: > http://pixelcone.com/tutorial/ajax-file-upload-using-jquery-and-cakep... > > - S > > On 24 August 2011 03:37, 8vius wrote: > > > > > > > > > I'm really struggling to find a solution for what I want to do. I want > > to be able to upload several image files simultaneously but I don't > > want to have several file boxes but just one where the user can select > > several files to upload, what is the best plugin and solution on the > > frontend side to do this? > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Multiple file upload
http://pixelcone.com/tutorial/ajax-file-upload-using-jquery-and-cakephp-media-plugin/ - S On 24 August 2011 03:37, 8vius wrote: > I'm really struggling to find a solution for what I want to do. I want > to be able to upload several image files simultaneously but I don't > want to have several file boxes but just one where the user can select > several files to upload, what is the best plugin and solution on the > frontend side to do this? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Multiple file upload
I'm really struggling to find a solution for what I want to do. I want to be able to upload several image files simultaneously but I don't want to have several file boxes but just one where the user can select several files to upload, what is the best plugin and solution on the frontend side to do this? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File Upload error - PNG MIME type with Internet Explorer (can't re-enact)
On May 12, 2011, at 06:29, Ross wrote: > I'm using > http://www.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_cakephp > > I'm unable to duplicate the problem, but a client using an early > version of an app says that they can't upload PNG images without > getting an error (Error: XXX.png cannot be uploaded. Acceptable file > types: JPG, GIF, PNG). > > I'm at a loss as the upload appears to work fine for me. He is using > IE8. > > I don't really have much to go on - has anyone experienced a problem > uploading with CakePHP and IE before? I am able to use the app and > upload using IE with no issues, but I'm at a loss. Either the file the user is uploading is not a PNG (or GIF or JPG) file (despite it having the .png extension), or the browser the customer is using is not properly sending the file's MIME type when uploading it to the server. Have the user try a different browser. If the problem persists, suspect that the error message is right -- that the file type is not acceptable. (Confirm the file's contents using other means -- have the customer try to open it in an image viewing program that can give information about the file and display its filetype.) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
File Upload error - PNG MIME type with Internet Explorer (can't re-enact)
Hi, I'm using http://www.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_cakephp I'm unable to duplicate the problem, but a client using an early version of an app says that they can't upload PNG images without getting an error (Error: XXX.png cannot be uploaded. Acceptable file types: JPG, GIF, PNG). I'm at a loss as the upload appears to work fine for me. He is using IE8. I don't really have much to go on - has anyone experienced a problem uploading with CakePHP and IE before? I am able to use the app and upload using IE with no issues, but I'm at a loss. Sorry for not being more specific, but I'm not sure what I can provide! Thanks. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
jQuery File Upload in cakePHP
Hello there. I think you may know http://plugins.jquery.com/project/jQuery-File-Upload jQuery File Upload , it's a jQuery plugin that allows you to upload multiple files, and it's very easy to implement in a "Pure PHP" Website. But I'm newbie in CakePHP, and I've no idea about how to implement it. I appreciate any help. -- View this message in context: http://cakephp.1045679.n5.nabble.com/jQuery-File-Upload-in-cakePHP-tp4370017p4370017.html Sent from the CakePHP mailing list archive at Nabble.com. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
I'm using the latest stable version, 1.3.8. I'm just going to use the stable 2.1.4 version of uploadify to make sure when we're figuring this out we don't have too many problems :P (I'm tired of trying to make all these different uploaders I've found work >_>) ((btw, I want to save these files to the disk not to the db if that makes a difference.)) On Apr 1, 6:01 am, Ravi Verma wrote: > Hi Rishab, > > It's very easy to use and follows all the cakephp URL credentials also. I > have implemented it many times with the same url [Just like you have > mentioned]. Please let me know what version of cake you are using. Let's > debug it. > > > > > > > > > > On Fri, Apr 1, 2011 at 9:22 AM, Chris wrote: > > I would like to know how you would setup uploadify for cake. Could you > > please post instructions? > > > On Mar 31, 3:49 am, Ravi wrote: > > > Hi Rishab, > > > > You can use Uploadify (http://www.uploadify.com/). This is a free > > > flash uploading utility for PHP. > > > > And also it is quite easy to implement your own multiple file > > > uploading functionality. Do let me know if you need instructions to > > > implement your own functionality. > > > > Thanks, > > > Ravi Verma > > > > On Mar 31, 12:46 pm, Rishab Jain wrote: > > > > > Hi, > > > > > Does anybody know of a good multiple file upload in cakephp (or even > > php for > > > > that matter). I'm not looking for many input tags for upload, but for > > an > > > > interface where I can upload many files in one go. > > > > > And it should be a freeware. > > > > > regards, > > > > Rishab > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php > > -- > Thanks & Regards > = > Ravi Verma > Software Engineer -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
Hi Rishab, It's very easy to use and follows all the cakephp URL credentials also. I have implemented it many times with the same url [Just like you have mentioned]. Please let me know what version of cake you are using. Let's debug it. On Fri, Apr 1, 2011 at 9:22 AM, Chris wrote: > I would like to know how you would setup uploadify for cake. Could you > please post instructions? > > On Mar 31, 3:49 am, Ravi wrote: > > Hi Rishab, > > > > You can use Uploadify (http://www.uploadify.com/). This is a free > > flash uploading utility for PHP. > > > > And also it is quite easy to implement your own multiple file > > uploading functionality. Do let me know if you need instructions to > > implement your own functionality. > > > > Thanks, > > Ravi Verma > > > > On Mar 31, 12:46 pm, Rishab Jain wrote: > > > > > > > > > > > > > > > > > Hi, > > > > > Does anybody know of a good multiple file upload in cakephp (or even > php for > > > that matter). I'm not looking for many input tags for upload, but for > an > > > interface where I can upload many files in one go. > > > > > And it should be a freeware. > > > > > regards, > > > Rishab > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Thanks & Regards = Ravi Verma Software Engineer -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
I would like to know how you would setup uploadify for cake. Could you please post instructions? On Mar 31, 3:49 am, Ravi wrote: > Hi Rishab, > > You can use Uploadify (http://www.uploadify.com/). This is a free > flash uploading utility for PHP. > > And also it is quite easy to implement your own multiple file > uploading functionality. Do let me know if you need instructions to > implement your own functionality. > > Thanks, > Ravi Verma > > On Mar 31, 12:46 pm, Rishab Jain wrote: > > > > > > > > > Hi, > > > Does anybody know of a good multiple file upload in cakephp (or even php for > > that matter). I'm not looking for many input tags for upload, but for an > > interface where I can upload many files in one go. > > > And it should be a freeware. > > > regards, > > Rishab -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
On Thu, Mar 31, 2011 at 3:34 PM, Rishab Jain wrote: > Hi, > > This works fine when I created a non-cakephp based setup. However, when I > try to use it in a cake based setup, it gives me an error. After almost an > hour of debugging, I saw that the problem lies in, > > $('#file_upload').uploadify({ > 'uploader' : 'path_to_uploadifyswf/uploadify.swf', > 'script' : 'http://dev.mydomain.com/multiupload/', > 'cancelImg' : 'pathtoimages/cancel.png', > 'folder' : 'uploaded_files', > 'multi' : true, > > Here, when I give the script URL to be of an action of a controller, it > gives me a 302 Error. However, when I change it to > 'script' : > 'http://dev.mydomain.com/non_cake_based_setup/multiupload.php', > > It works then. > > Really have no idea about this behaviour. Anybody having any idea here? Do you have a route for '/multiupload/'? That needs to point to a controller somehow. Mine is: Router::connect( '/upload', array('controller' => 'files', 'action' => 'upload') ); BTW, I'm using Nick Baker's FileUpload plugin and jQuery.MultiFile. http://www.webtechnick.com/blogs/view/221/CakePHP_File_Upload_Plugin http://code.google.com/p/jquery-multifile-plugin/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
Hi, This works fine when I created a non-cakephp based setup. However, when I try to use it in a cake based setup, it gives me an error. After almost an hour of debugging, I saw that the problem lies in, $('#file_upload').uploadify({ 'uploader' : 'path_to_uploadifyswf/uploadify.swf', 'script': 'http://dev.mydomain.com/multiupload/', 'cancelImg' : 'pathtoimages/cancel.png', 'folder': 'uploaded_files', 'multi' : true, Here, when I give the script URL to be of an action of a controller, it gives me a 302 Error. However, when I change it to 'script': ' http://dev.mydomain.com/non_cake_based_setup/multiupload.php', It works then. Really have no idea about this behaviour. Anybody having any idea here? regards, Rishab On Thu, Mar 31, 2011 at 1:19 PM, Ravi wrote: > Hi Rishab, > > You can use Uploadify (http://www.uploadify.com/). This is a free > flash uploading utility for PHP. > > And also it is quite easy to implement your own multiple file > uploading functionality. Do let me know if you need instructions to > implement your own functionality. > > Thanks, > Ravi Verma > > On Mar 31, 12:46 pm, Rishab Jain wrote: > > Hi, > > > > Does anybody know of a good multiple file upload in cakephp (or even php > for > > that matter). I'm not looking for many input tags for upload, but for an > > interface where I can upload many files in one go. > > > > And it should be a freeware. > > > > regards, > > Rishab > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
> Does anybody know of a good multiple file upload in cakephp (or even php > for that matter). I'm not looking for many input tags for upload, but for an > interface where I can upload many files in one go. > > And it should be a freeware. > This is multiple file upload in jquery > http://aquantum-demo.appspot.com/file-upload > -- Regards sathia http://www.sathia27.wordpress.com -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
Thanks Ravi. It worked. And implementing it was pretty easy as well. regards, Rishab On Thu, Mar 31, 2011 at 1:19 PM, Ravi wrote: > Hi Rishab, > > You can use Uploadify (http://www.uploadify.com/). This is a free > flash uploading utility for PHP. > > And also it is quite easy to implement your own multiple file > uploading functionality. Do let me know if you need instructions to > implement your own functionality. > > Thanks, > Ravi Verma > > On Mar 31, 12:46 pm, Rishab Jain wrote: > > Hi, > > > > Does anybody know of a good multiple file upload in cakephp (or even php > for > > that matter). I'm not looking for many input tags for upload, but for an > > interface where I can upload many files in one go. > > > > And it should be a freeware. > > > > regards, > > Rishab > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: multiple file upload in php
Hi Rishab, You can use Uploadify (http://www.uploadify.com/). This is a free flash uploading utility for PHP. And also it is quite easy to implement your own multiple file uploading functionality. Do let me know if you need instructions to implement your own functionality. Thanks, Ravi Verma On Mar 31, 12:46 pm, Rishab Jain wrote: > Hi, > > Does anybody know of a good multiple file upload in cakephp (or even php for > that matter). I'm not looking for many input tags for upload, but for an > interface where I can upload many files in one go. > > And it should be a freeware. > > regards, > Rishab -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
multiple file upload in php
Hi, Does anybody know of a good multiple file upload in cakephp (or even php for that matter). I'm not looking for many input tags for upload, but for an interface where I can upload many files in one go. And it should be a freeware. regards, Rishab -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: file upload with miles johnsons upload plugin - without model
thank you very much. On 24 Feb., 19:32, Miles J wrote: > Your form is posting to a completely different url. Try setting this: > > echo $form->create('Model', array('type' => 'file', 'url' => > array('controller'=>'pages','action'=>'display', 'upload'))); > > On Feb 24, 9:05 am, soymartinus wrote: > > > Hi > > i'm new to cakephp and can't get miles johnsons upload plugin > > (http://www.milesj.me/resources/script/uploader-plugin) to work. > > > i don't use/need a database for the upload form. > > so i created the upload.ctp in app/views/pages > > > echo $form->create('Model', array('type' => 'file')); > > echo $form->input('fileName', array('type' => 'file')); > > echo $form->end('Upload'); > > > and added to the pages_controller the > > function upload() like explained in the tutorial on miles webpage. > > > in routes.php i put > > Router::connect('/upload', > > array('controller'=>'pages','action'=>'display', 'upload')); > > > thats what i added to the pages_controller: > > > //uploader plugin > > var $components = array('Uploader.Uploader'); > > var $actsAs = array('Uploader.FileValidation'); > > > function upload() { > > //http://www.milesj.me/resources/script/uploader-plugin > > $this->set('testvar', "hello world"); > > $this->Uploader->uploadDir = 'files/uploads/'; > > $this->Uploader->enableUpload = true; > > $this->Uploader->maxFileSize = '8M'; // 8 Megabytes > > $this->Uploader->maxNameLength = 40; > > //$this->Uploader->mime('image', 'gif', 'image/gif'); > > //$this->Uploader->delete('files/uploads/filename.jpg'); > > > if (!empty($this->data)) { > > if ($data = $this->Uploader->upload('fileName', > > array('overwrite' => > > true, 'name' => 'new_fileName'))){ > > debug($data); > > } > > } > > > } > > > when i now want to upload a file, i get always the error: > > Error: ModelsController could not be found. > > > thank you very much in advance for any help > > > regards from spain, martin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: file upload with miles johnsons upload plugin - without model
Your form is posting to a completely different url. Try setting this: echo $form->create('Model', array('type' => 'file', 'url' => array('controller'=>'pages','action'=>'display', 'upload'))); On Feb 24, 9:05 am, soymartinus wrote: > Hi > i'm new to cakephp and can't get miles johnsons upload plugin > (http://www.milesj.me/resources/script/uploader-plugin) to work. > > i don't use/need a database for the upload form. > so i created the upload.ctp in app/views/pages > > echo $form->create('Model', array('type' => 'file')); > echo $form->input('fileName', array('type' => 'file')); > echo $form->end('Upload'); > > and added to the pages_controller the > function upload() like explained in the tutorial on miles webpage. > > in routes.php i put > Router::connect('/upload', > array('controller'=>'pages','action'=>'display', 'upload')); > > thats what i added to the pages_controller: > > //uploader plugin > var $components = array('Uploader.Uploader'); > var $actsAs = array('Uploader.FileValidation'); > > function upload() { > //http://www.milesj.me/resources/script/uploader-plugin > $this->set('testvar', "hello world"); > $this->Uploader->uploadDir = 'files/uploads/'; > $this->Uploader->enableUpload = true; > $this->Uploader->maxFileSize = '8M'; // 8 Megabytes > $this->Uploader->maxNameLength = 40; > //$this->Uploader->mime('image', 'gif', 'image/gif'); > //$this->Uploader->delete('files/uploads/filename.jpg'); > > if (!empty($this->data)) { > if ($data = $this->Uploader->upload('fileName', > array('overwrite' => > true, 'name' => 'new_fileName'))){ > debug($data); > } > } > > } > > when i now want to upload a file, i get always the error: > Error: ModelsController could not be found. > > thank you very much in advance for any help > > regards from spain, martin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
file upload with miles johnsons upload plugin - without model
Hi i'm new to cakephp and can't get miles johnsons upload plugin ( http://www.milesj.me/resources/script/uploader-plugin ) to work. i don't use/need a database for the upload form. so i created the upload.ctp in app/views/pages echo $form->create('Model', array('type' => 'file')); echo $form->input('fileName', array('type' => 'file')); echo $form->end('Upload'); and added to the pages_controller the function upload() like explained in the tutorial on miles webpage. in routes.php i put Router::connect('/upload', array('controller'=>'pages','action'=>'display', 'upload')); thats what i added to the pages_controller: //uploader plugin var $components = array('Uploader.Uploader'); var $actsAs = array('Uploader.FileValidation'); function upload() { //http://www.milesj.me/resources/script/uploader-plugin $this->set('testvar', "hello world"); $this->Uploader->uploadDir = 'files/uploads/'; $this->Uploader->enableUpload = true; $this->Uploader->maxFileSize = '8M'; // 8 Megabytes $this->Uploader->maxNameLength = 40; //$this->Uploader->mime('image', 'gif', 'image/gif'); //$this->Uploader->delete('files/uploads/filename.jpg'); if (!empty($this->data)) { if ($data = $this->Uploader->upload('fileName', array('overwrite' => true, 'name' => 'new_fileName'))){ debug($data); } } } when i now want to upload a file, i get always the error: Error: ModelsController could not be found. thank you very much in advance for any help regards from spain, martin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload issues
you should do this... create('Course', array('type' => 'file'));?> -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/2/8 mr.paul.wheatley > That was it, i changed the 2nd line to > > create('Course', array('enctype' => > 'multipart/form-data'));?> > > And it all worked perfectly, thanks all! > > Paul > > On 08 Feb, 2011,at 01:21 AM, cricket wrote: > > Don't open and close the form manually if you're going to use > FormHelper to create inputs. > > echo $this->Form->create(...); > ... > echo $this->Form->end(...); > > On Mon, Feb 7, 2011 at 1:58 PM, mr.paul.wheatley > wrote: > > Yup, of course you will need that, sorry. Here it is... > > > > > > > enctype="multipart/form-data"> > > > > > > > > > > Course Title > > Address 1 > > > > > > input('name', array('type' => 'text', > > 'label' => false)); ?> > > input('address', array('type' => > 'text', > > 'label' => false)); ?> > > > > > > Telephone Number > > Address 2 > > > > > > input('telephone', array('type' => > 'text', > > 'label' => false)); ?> > > input('address2', array('type' => > 'text', > > 'label' => false)); ?> > > > > > > Website > > Area > > > > > > input('url', array('type' => 'text', > > 'label' => false)); ?> > > input('area', array('type' => 'text', > > 'label' => false)); ?> > > > > > > Email Address > > Postcode > > > > > > input('email', array('type' => 'text', > > 'label' => false)); ?> > > input('postcode', array('type' => > 'text', > > 'label' => false)); ?> > > > > > > Course Logo > > > > > > > id="FileImage" /> > > > > > > > > > > > > > > > > Introduction text (this will for the introduction for > your > > sites page) > > input('introduction', array('label' => > > false)); ?> > > Description of your course > > input('description', array('label' => > > false)); ?> > > Descrption of your cources features > > input('features', array('label' => > > false)); ?> > > List all fees for your course, e.g. green fees, tuition, > > caddy hire, etc... > > input('fees', array('label' => false)); > > ?> > > Opening times > > input('opening', array('label' => > false)); > > ?> > > > > > > > > > > > > > > Entry Options > > input('member_id', array('label' => > > false)); ?> > > > > > > Dress Code > > input('outfit_id', array('label' => > > false)); ?> > > > > > > What type of course is it? > > input('type_id', array('label' => > false)); > > ?> > > > > > > Course rating > > input('rating_id', array('label' => > > false)); ?> > > > > > > > > > > > > > > > > input('Deal', array('type' => 'select', > > 'multiple' => 'checkbox', 'label' => false)); ?> > > > > > > > > > > > > > > > > input('Facility', array('type' => > > 'select', 'multiple' => 'checkbox', 'label' => false)); ?> > > > > > > > > > > input('user_id', array('type' => 'hidden')); ?> > > end('Add course');?> > > > > > > Paul > > > > On 07 Feb, 2011,at 02:57 PM, kdubya wrote: > > > > Show us your view code that builds the form. > > > > Ken > > > > -- > > Our newest site for the community: CakePHP Video Tutorials > > http://tv.cakephp.org > > Check out the new CakePHP Questions site http://ask.cakephp.org and help > > others with their CakePHP related questions. > > > > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at > > http://groups.google.com/group/cake-php > > > > -- > > Our newest site for the community: CakePHP Video Tutorials > > http://tv.cakephp.org > > Check out the new CakePHP Questions site http://ask.cakephp.org and help > > others with their CakePHP related questions. > > > > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at > > http://groups.google.com/group/cake-php > > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > > -- > Our newe
Re: File upload issues
That was it, i changed the 2nd line to create('Course', array('enctype' => 'multipart/form-data'));?> And it all worked perfectly, thanks all! Paul On 08 Feb, 2011,at 01:21 AM, cricket wrote: Don't open and close the form manually if you're going to use FormHelper to create inputs. echo $this->Form->create(...); ... echo $this->Form->end(...); On Mon, Feb 7, 2011 at 1:58 PM, mr.paul.wheatley wrote: > Yup, of course you will need that, sorry. Here it is... > > > enctype="multipart/form-data"> > > > > > Course Title > Address 1 > > > input('name', array('type' => 'text', > 'label' => false)); ?> > input('address', array('type' => 'text', > 'label' => false)); ?> > > > Telephone Number > Address 2 > > > input('telephone', array('type' => 'text', > 'label' => false)); ?> > input('address2', array('type' => 'text', > 'label' => false)); ?> > > > Website > Area > > > input('url', array('type' => 'text', > 'label' => false)); ?> > input('area', array('type' => 'text', > 'label' => false)); ?> > > > Email Address > Postcode > > > input('email', array('type' => 'text', > 'label' => false)); ?> > input('postcode', array('type' => 'text', > 'label' => false)); ?> > > > Course Logo > > > id="FileImage" /> > > > > > > > > Introduction text (this will for the introduction for your > sites page) > input('introduction', array('label' => > false)); ?> > Description of your course > input('description', array('label' => > false)); ?> > Descrption of your cources features > input('features', array('label' => > false)); ?> > List all fees for your course, e.g. green fees, tuition, > caddy hire, etc... > input('fees', array('label' => false)); > ?> > Opening times > input('opening', array('label' => false)); > ?> > > > > > > > Entry Options > input('member_id', array('label' => > false)); ?> > > > Dress Code > input('outfit_id', array('label' => > false)); ?> > > > What type of course is it? > input('type_id', array('label' => false)); > ?> > > > Course rating > input('rating_id', array('label' => > false)); ?> > > > > > > > > input('Deal', array('type' => 'select', > 'multiple' => 'checkbox', 'label' => false)); ?> > > > > > > > > input('Facility', array('type' => > 'select', 'multiple' => 'checkbox', 'label' => false)); ?> > > > > > input('user_id', array('type' => 'hidden')); ?> > end('Add course');?> > > > Paul > > On 07 Feb, 2011,at 02:57 PM, kdubya wrote: > > Show us your view code that builds the form. > > Ken > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload issues
Don't open and close the form manually if you're going to use FormHelper to create inputs. echo $this->Form->create(...); ... echo $this->Form->end(...); On Mon, Feb 7, 2011 at 1:58 PM, mr.paul.wheatley wrote: > Yup, of course you will need that, sorry. Here it is... > > > enctype="multipart/form-data"> > > > > > Course Title > Address 1 > > > input('name', array('type' => 'text', > 'label' => false)); ?> > input('address', array('type' => 'text', > 'label' => false)); ?> > > > Telephone Number > Address 2 > > > input('telephone', array('type' => 'text', > 'label' => false)); ?> > input('address2', array('type' => 'text', > 'label' => false)); ?> > > > Website > Area > > > input('url', array('type' => 'text', > 'label' => false)); ?> > input('area', array('type' => 'text', > 'label' => false)); ?> > > > Email Address > Postcode > > > input('email', array('type' => 'text', > 'label' => false)); ?> > input('postcode', array('type' => 'text', > 'label' => false)); ?> > > > Course Logo > > > id="FileImage" /> > > > > > > > > Introduction text (this will for the introduction for your > sites page) > input('introduction', array('label' => > false)); ?> > Description of your course > input('description', array('label' => > false)); ?> > Descrption of your cources features > input('features', array('label' => > false)); ?> > List all fees for your course, e.g. green fees, tuition, > caddy hire, etc... > input('fees', array('label' => false)); > ?> > Opening times > input('opening', array('label' => false)); > ?> > > > > > > > Entry Options > input('member_id', array('label' => > false)); ?> > > > Dress Code > input('outfit_id', array('label' => > false)); ?> > > > What type of course is it? > input('type_id', array('label' => false)); > ?> > > > Course rating > input('rating_id', array('label' => > false)); ?> > > > > > > > > input('Deal', array('type' => 'select', > 'multiple' => 'checkbox', 'label' => false)); ?> > > > > > > > > input('Facility', array('type' => > 'select', 'multiple' => 'checkbox', 'label' => false)); ?> > > > > > input('user_id', array('type' => 'hidden')); ?> > end('Add course');?> > > > Paul > > On 07 Feb, 2011,at 02:57 PM, kdubya wrote: > > Show us your view code that builds the form. > > Ken > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload issues
On Feb 7, 2011, at 12:58, mr.paul.wheatley wrote: > id="FileImage" /> Why not use $form->input() to create this input element as well? You've used it for all your other elements... -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload issues
Yup, of course you will need that, sorry. Here it is... Course Title Address 1 input('name', array('type' => 'text', 'label' => false)); ?> input('address', array('type' => 'text', 'label' => false)); ?> Telephone Number Address 2 input('telephone', array('type' => 'text', 'label' => false)); ?> input('address2', array('type' => 'text', 'label' => false)); ?> Website Area input('url', array('type' => 'text', 'label' => false)); ?> input('area', array('type' => 'text', 'label' => false)); ?> Email Address Postcode input('email', array('type' => 'text', 'label' => false)); ?> input('postcode', array('type' => 'text', 'label' => false)); ?> Course Logo Introduction text (this will for the introduction for your sites page) input('introduction', array('label' => false)); ?> Description of your course input('description', array('label' => false)); ?> Descrption of your cources features input('features', array('label' => false)); ?> List all fees for your course, e.g. green fees, tuition, caddy hire, etc... input('fees', array('label' => false)); ?> Opening times input('opening', array('label' => false)); ?> Entry Options input('member_id', array('label' => false)); ?> Dress Code input('outfit_id', array('label' => false)); ?> What type of course is it? input('type_id', array('label' => false)); ?> Course rating input('rating_id', array('label' => false)); ?> input('Deal', array('type' => 'select', 'multiple' => 'checkbox', 'label' => false)); ?> input('Facility', array('type' => 'select', 'multiple' => 'checkbox', 'label' => false)); ?> input('user_id', array('type' => 'hidden')); ?> end('Add course');?> Paul On 07 Feb, 2011,at 02:57 PM, kdubya wrote: Show us your view code that builds the form. Ken -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload issues
Show us your view code that builds the form. Ken -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
File upload issues
Hi, I am creating a form with a file upload function, the form was working fine (adding text based information) before i added the file upload function, now the file upload function is working fine (uploading the file and adding the URL to the DB) and the form is adding the User ID but the rest of the form data is not working, i am getting no errors. Here is my add function from the controller... function add() { if (!empty($this->data)) { $fileOK = $this->uploadFiles('img/files', $this->data['File']); $this->data['Course']['image_url'] = $fileOK['urls'][0]; $this->data['Course']['user_id'] = $this->Session->read('Auth.User.id'); if ($this->Course->save($this->data)) { $this->Session->setFlash(__('Course saved.', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The course could not be saved Please try again.', true)); } } $members = $this->Course->Member->find('list'); $outfits = $this->Course->Outfit->find('list'); $types = $this->Course->Type->find('list'); $ratings = $this->Course->Rating->find('list'); $comments = $this->Course->Comment->find('list'); $deals = $this->Course->Deal->find('list'); $facilities = $this->Course->Facility->find('list'); $this->set(compact('members', 'outfits', 'types', 'ratings', 'comments', 'deals', 'facilities')); } I am fairly new to Cake and my first guess would be that i am implicitly telling it to add the file and the user ID but not the rest of the fields, but on saying that it was all working fine before i added "$fileOK = $this->uploadFiles('img/files', $this->data['File']);" and "$this->data['Course']['image_url'] = $fileOK['urls'][0];" Help! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem in simple file upload
View the source of your HTML and make sure the form action is pointing to the right URL. Also what version of the Uploader are you using? You should download the latest version off of Github. Furthermore, your file type must be supported, if it is not, you have to add it to the mime types array. On Feb 1, 3:11 pm, newguy wrote: > I checked the _mime types but couldnt find a error in there, am stuck > guys please suggest something. > > On Feb 1, 2:50 pm, Stephen wrote: > > > Nope, you called the field "aiman". So when checking for the file, check the > > field named "aiman" for example $this->data['Model']['aiman']['tmp_name'] > > > On 1 February 2011 22:43, newguy wrote: > > > > Stephen one simple question, this line in upload.cpt > > > echo $form->input('aiman', array('type' => 'file')); > > > means that I can upload only file named aiman?? > > > > On Feb 1, 2:17 pm, Stephen wrote: > > > > This error tells me that your form is successfully reaching the correct > > > > action "upload". > > > > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The > > > syntax > > > > is correct enough. > > > > > On 1 February 2011 21:55, newguy wrote: > > > > > > I tried that, this time no call was made to add action but I got this > > > > > warning: > > > > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > > > > controllers/components/uploader.php, line 1084] > > > > > > This is the foreach in which warning is coming: > > > > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > > > > if (isset($mimes[$this->__data[$this->__current]['ext']])) > > > > > { > > > > > $validExt = true; > > > > > } > > > > > > also I could not find the file uploaded in tmp folder under app. > > > > > > On Feb 1, 1:44 pm, Stephen wrote: > > > > > > Try > > > > > > > create('User',array('action' => 'upload', > > > > > > 'type'=>'file')); ?> ? > > > > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > > Hi I am following this uploader plugin to implement simple file > > > upload > > > > > > > on my site: > > > > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > > > > but the problem is that when I press the upload button call to a > > > > > > > unknown action add is made, I dont have any action by the name of > > > add, > > > > > > > here is my code: > > > > > > > > After log in user is directed to index.cpt which has the option to > > > > > > > upload score: > > > > > > > > / > > > > > > > index.cpt > > > > > > > > > > > > > > Hello, > > $user['last_name']); ? > > > > > > > > > > > > > > > Welcome to Game Web Site > > > > > > > > > > > > > > > > $html->link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > > > > > > > link('Upload > > > Score',array('action'=>'upload')); ? > > > > > > > > > > > > > > > link('logout', array('action' => 'logout')); > > > ?> > > > > > > li> > > > > > > > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > > > > > > > upload.cpt > > > > > > > // > > > > > > > > > > > > > > echo $form->create('User',array('type'=>'file')); > > > > > > > //echo $form->file('File'); > > > > > > > echo $form->input('aiman', array('type' => 'file')); > > > > > > > > //echo $form->submit('Upload'); > > > > >
Re: Problem in simple file upload
I checked the _mime types but couldnt find a error in there, am stuck guys please suggest something. On Feb 1, 2:50 pm, Stephen wrote: > Nope, you called the field "aiman". So when checking for the file, check the > field named "aiman" for example $this->data['Model']['aiman']['tmp_name'] > > On 1 February 2011 22:43, newguy wrote: > > > > > > > > > > > Stephen one simple question, this line in upload.cpt > > echo $form->input('aiman', array('type' => 'file')); > > means that I can upload only file named aiman?? > > > On Feb 1, 2:17 pm, Stephen wrote: > > > This error tells me that your form is successfully reaching the correct > > > action "upload". > > > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The > > syntax > > > is correct enough. > > > > On 1 February 2011 21:55, newguy wrote: > > > > > I tried that, this time no call was made to add action but I got this > > > > warning: > > > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > > > controllers/components/uploader.php, line 1084] > > > > > This is the foreach in which warning is coming: > > > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > > > if (isset($mimes[$this->__data[$this->__current]['ext']])) > > > > { > > > > $validExt = true; > > > > } > > > > > also I could not find the file uploaded in tmp folder under app. > > > > > On Feb 1, 1:44 pm, Stephen wrote: > > > > > Try > > > > > > create('User',array('action' => 'upload', > > > > > 'type'=>'file')); ?> ? > > > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > Hi I am following this uploader plugin to implement simple file > > upload > > > > > > on my site: > > > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > > > but the problem is that when I press the upload button call to a > > > > > > unknown action add is made, I dont have any action by the name of > > add, > > > > > > here is my code: > > > > > > > After log in user is directed to index.cpt which has the option to > > > > > > upload score: > > > > > > > / > > > > > > index.cpt > > > > > > > > > > > > Hello, > $user['last_name']); ? > > > > > > > > > > > > > Welcome to Game Web Site > > > > > > > > > > > > > $html->link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > > > > > link('Upload > > Score',array('action'=>'upload')); ? > > > > > > > > > > > > > link('logout', array('action' => 'logout')); > > ?> > > > > > li> > > > > > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > > > > > upload.cpt > > > > > > // > > > > > > > > > > > > echo $form->create('User',array('type'=>'file')); > > > > > > //echo $form->file('File'); > > > > > > echo $form->input('aiman', array('type' => 'file')); > > > > > > > //echo $form->submit('Upload'); > > > > > > echo $form->end('Upload2'); > > > > > > ?> > > > > > > > now when I press upload2 button I get the following error: > > > > > > > > > > > > Missing Method in UsersController > > > > > > Error: The action add is not defined in controller UsersController > > > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > > > > users_controller.php. > > > > > > > > > > > > class UsersCo
Re: Problem in simple file upload
Nope, you called the field "aiman". So when checking for the file, check the field named "aiman" for example $this->data['Model']['aiman']['tmp_name'] On 1 February 2011 22:43, newguy wrote: > Stephen one simple question, this line in upload.cpt > echo $form->input('aiman', array('type' => 'file')); > means that I can upload only file named aiman?? > > > On Feb 1, 2:17 pm, Stephen wrote: > > This error tells me that your form is successfully reaching the correct > > action "upload". > > > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The > syntax > > is correct enough. > > > > On 1 February 2011 21:55, newguy wrote: > > > > > > > > > > > > > > > > > > > > > I tried that, this time no call was made to add action but I got this > > > warning: > > > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > > controllers/components/uploader.php, line 1084] > > > > > This is the foreach in which warning is coming: > > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > >if (isset($mimes[$this->__data[$this->__current]['ext']])) > > > { > > >$validExt = true; > > > } > > > > > also I could not find the file uploaded in tmp folder under app. > > > > > On Feb 1, 1:44 pm, Stephen wrote: > > > > Try > > > > > > create('User',array('action' => 'upload', > > > > 'type'=>'file')); ?> ? > > > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > Hi I am following this uploader plugin to implement simple file > upload > > > > > on my site: > > > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > > > but the problem is that when I press the upload button call to a > > > > > unknown action add is made, I dont have any action by the name of > add, > > > > > here is my code: > > > > > > > After log in user is directed to index.cpt which has the option to > > > > > upload score: > > > > > > > / > > > > > index.cpt > > > > > > > > > > Hello, $user['last_name']); ? > > > > > > > > > > > Welcome to Game Web Site > > > > > > > > > > $html->link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > > > link('Upload > Score',array('action'=>'upload')); ? > > > > > > > > > > > link('logout', array('action' => 'logout')); > ?> > > > > li> > > > > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > > > > upload.cpt > > > > > // > > > > > > > > > > >echo $form->create('User',array('type'=>'file')); > > > > >//echo $form->file('File'); > > > > >echo $form->input('aiman', array('type' => 'file')); > > > > > > >//echo $form->submit('Upload'); > > > > >echo $form->end('Upload2'); > > > > > ?> > > > > > > > now when I press upload2 button I get the following error: > > > > > > > > > > Missing Method in UsersController > > > > > Error: The action add is not defined in controller UsersController > > > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > > > users_controller.php. > > > > > > > > > > > class UsersController extends AppController { > > > > > > >var $name = 'Users'; > > > > > > >function add() { > > > > > > >} > > > > > > > } > > > > > ?> > > > > > /// > > > > > > > Here is my controller: > > > &g
Re: Problem in simple file upload
Stephen one simple question, this line in upload.cpt echo $form->input('aiman', array('type' => 'file')); means that I can upload only file named aiman?? On Feb 1, 2:17 pm, Stephen wrote: > This error tells me that your form is successfully reaching the correct > action "upload". > > Check that $this->__mimeTypes is valid, it sounds like it isn't. The syntax > is correct enough. > > On 1 February 2011 21:55, newguy wrote: > > > > > > > > > > > I tried that, this time no call was made to add action but I got this > > warning: > > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > > controllers/components/uploader.php, line 1084] > > > This is the foreach in which warning is coming: > > foreach ($this->__mimeTypes as $grouping => $mimes) { > > if (isset($mimes[$this->__data[$this->__current]['ext']])) > > { > > $validExt = true; > > } > > > also I could not find the file uploaded in tmp folder under app. > > > On Feb 1, 1:44 pm, Stephen wrote: > > > Try > > > > create('User',array('action' => 'upload', > > > 'type'=>'file')); ?> ? > > > > On 1 February 2011 21:41, newguy wrote: > > > > > Hi I am following this uploader plugin to implement simple file upload > > > > on my site: > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > but the problem is that when I press the upload button call to a > > > > unknown action add is made, I dont have any action by the name of add, > > > > here is my code: > > > > > After log in user is directed to index.cpt which has the option to > > > > upload score: > > > > > / > > > > index.cpt > > > > > > > > Hello, > > > > > > > > Welcome to Game Web Site > > > > > > > > link('Downloads',array('action'=>'downloads')); ? > > > > > > > > > link('Upload Score',array('action'=>'upload')); ? > > > > > > > > > link('logout', array('action' => 'logout')); ?> > > > li> > > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > > upload.cpt > > > > // > > > > > > > > echo $form->create('User',array('type'=>'file')); > > > > //echo $form->file('File'); > > > > echo $form->input('aiman', array('type' => 'file')); > > > > > //echo $form->submit('Upload'); > > > > echo $form->end('Upload2'); > > > > ?> > > > > > now when I press upload2 button I get the following error: > > > > > > > > Missing Method in UsersController > > > > Error: The action add is not defined in controller UsersController > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > > users_controller.php. > > > > > > > > class UsersController extends AppController { > > > > > var $name = 'Users'; > > > > > function add() { > > > > > } > > > > > } > > > > ?> > > > > /// > > > > > Here is my controller: > > > > > > > > > class UsersController extends AppController > > > > { > > > > var $name = 'Users'; > > > > var $helpers = array('Html', 'Form'); > > > > var $components = array('Uploader.Uploader'); > > > > > function register() > > > > { > > > > if (!empty($this->data)) > > > > { > > > > $this->data['User']['password'] = > > > > md5($this->data['User'] > > > > ['password']); > > > > if ($this->User->save($this->data)) > > > > { > > > >
Re: Problem in simple file upload
This error tells me that your form is successfully reaching the correct action "upload". Check that $this->__mimeTypes is valid, it sounds like it isn't. The syntax is correct enough. On 1 February 2011 21:55, newguy wrote: > I tried that, this time no call was made to add action but I got this > warning: > > Invalid argument supplied for foreach() [APP/plugins/uploader/ > controllers/components/uploader.php, line 1084] > > This is the foreach in which warning is coming: > foreach ($this->__mimeTypes as $grouping => $mimes) { >if (isset($mimes[$this->__data[$this->__current]['ext']])) > { >$validExt = true; >} > > also I could not find the file uploaded in tmp folder under app. > > > On Feb 1, 1:44 pm, Stephen wrote: > > Try > > > > create('User',array('action' => 'upload', > > 'type'=>'file')); ?> ? > > > > On 1 February 2011 21:41, newguy wrote: > > > > > > > > > > > > > > > > > > > > > Hi I am following this uploader plugin to implement simple file upload > > > on my site: > > > > >http://www.milesj.me/resources/script/uploader-plugin > > > > > but the problem is that when I press the upload button call to a > > > unknown action add is made, I dont have any action by the name of add, > > > here is my code: > > > > > After log in user is directed to index.cpt which has the option to > > > upload score: > > > > > / > > > index.cpt > > > > > > Hello, > > > > > > Welcome to Game Web Site > > > > > > link('Downloads',array('action'=>'downloads')); ? > > > > > > > link('Upload Score',array('action'=>'upload')); ? > > > > > > > link('logout', array('action' => 'logout')); ?> > > li> > > > > > > > > On clicking Upload score link upload action is called > > > > > > > > upload.cpt > > > // > > > > > > >echo $form->create('User',array('type'=>'file')); > > >//echo $form->file('File'); > > >echo $form->input('aiman', array('type' => 'file')); > > > > >//echo $form->submit('Upload'); > > >echo $form->end('Upload2'); > > > ?> > > > > > now when I press upload2 button I get the following error: > > > > > > Missing Method in UsersController > > > Error: The action add is not defined in controller UsersController > > > > > Error: Create UsersController::add() in file: app/controllers/ > > > users_controller.php. > > > > > > > class UsersController extends AppController { > > > > >var $name = 'Users'; > > > > >function add() { > > > > >} > > > > > } > > > ?> > > > /// > > > > > Here is my controller: > > > > > > > > > class UsersController extends AppController > > > { > > >var $name = 'Users'; > > >var $helpers = array('Html', 'Form'); > > >var $components = array('Uploader.Uploader'); > > > > >function register() > > >{ > > >if (!empty($this->data)) > > >{ > > >$this->data['User']['password'] = > > > md5($this->data['User'] > > > ['password']); > > >if ($this->User->save($this->data)) > > >{ > > >$this->Session->setFlash('Your > > > registration information was > > > accepted'); > > >$this->Session->write('user', > > > $this->data['User']['username']); > > > > >$this->redirect(array('action' > => > > > 'index'), null, true); > > >
Re: Problem in simple file upload
I tried that, this time no call was made to add action but I got this warning: Invalid argument supplied for foreach() [APP/plugins/uploader/ controllers/components/uploader.php, line 1084] This is the foreach in which warning is coming: foreach ($this->__mimeTypes as $grouping => $mimes) { if (isset($mimes[$this->__data[$this->__current]['ext']])) { $validExt = true; } also I could not find the file uploaded in tmp folder under app. On Feb 1, 1:44 pm, Stephen wrote: > Try > > create('User',array('action' => 'upload', > 'type'=>'file')); ?> ? > > On 1 February 2011 21:41, newguy wrote: > > > > > > > > > > > Hi I am following this uploader plugin to implement simple file upload > > on my site: > > >http://www.milesj.me/resources/script/uploader-plugin > > > but the problem is that when I press the upload button call to a > > unknown action add is made, I dont have any action by the name of add, > > here is my code: > > > After log in user is directed to index.cpt which has the option to > > upload score: > > > / > > index.cpt > > > > Hello, > > > > Welcome to Game Web Site > > > > link('Downloads',array('action'=>'downloads')); ? > > > > > link('Upload Score',array('action'=>'upload')); ? > > > > > link('logout', array('action' => 'logout')); ?> > li> > > > > > On clicking Upload score link upload action is called > > > > > upload.cpt > > // > > > > echo $form->create('User',array('type'=>'file')); > > //echo $form->file('File'); > > echo $form->input('aiman', array('type' => 'file')); > > > //echo $form->submit('Upload'); > > echo $form->end('Upload2'); > > ?> > > > now when I press upload2 button I get the following error: > > > > Missing Method in UsersController > > Error: The action add is not defined in controller UsersController > > > Error: Create UsersController::add() in file: app/controllers/ > > users_controller.php. > > > > class UsersController extends AppController { > > > var $name = 'Users'; > > > function add() { > > > } > > > } > > ?> > > /// > > > Here is my controller: > > > > > class UsersController extends AppController > > { > > var $name = 'Users'; > > var $helpers = array('Html', 'Form'); > > var $components = array('Uploader.Uploader'); > > > function register() > > { > > if (!empty($this->data)) > > { > > $this->data['User']['password'] = > > md5($this->data['User'] > > ['password']); > > if ($this->User->save($this->data)) > > { > > $this->Session->setFlash('Your > > registration information was > > accepted'); > > $this->Session->write('user', > > $this->data['User']['username']); > > > $this->redirect(array('action' => > > 'index'), null, true); > > } > > else { > > $this->data['User']['password'] = > > ''; > > $this->Session->setFlash('There was > > a problem saving this > > information'); > > } > > } > > } > > > function login() > > { > > if ($this->data) > > { > > $results = > > $this->User->findByUsername($this->data['User'] > > ['username']); > > if ($results && $results['User']['password'] == > > md5($this- > > >data['
Re: Problem in simple file upload
Try create('User',array('action' => 'upload', 'type'=>'file')); ?> ? On 1 February 2011 21:41, newguy wrote: > Hi I am following this uploader plugin to implement simple file upload > on my site: > > http://www.milesj.me/resources/script/uploader-plugin > > but the problem is that when I press the upload button call to a > unknown action add is made, I dont have any action by the name of add, > here is my code: > > After log in user is directed to index.cpt which has the option to > upload score: > > / > index.cpt > > Hello, > > Welcome to Game Web Site > > link('Downloads',array('action'=>'downloads')); ? > > > link('Upload Score',array('action'=>'upload')); ? > > > link('logout', array('action' => 'logout')); ?> li> > > > On clicking Upload score link upload action is called > > > upload.cpt > // > > echo $form->create('User',array('type'=>'file')); >//echo $form->file('File'); >echo $form->input('aiman', array('type' => 'file')); > >//echo $form->submit('Upload'); >echo $form->end('Upload2'); > ?> > > now when I press upload2 button I get the following error: > > Missing Method in UsersController > Error: The action add is not defined in controller UsersController > > Error: Create UsersController::add() in file: app/controllers/ > users_controller.php. > > class UsersController extends AppController { > >var $name = 'Users'; > > >function add() { > >} > > } > ?> > /// > > Here is my controller: > > > > class UsersController extends AppController > { >var $name = 'Users'; >var $helpers = array('Html', 'Form'); >var $components = array('Uploader.Uploader'); > >function register() >{ >if (!empty($this->data)) >{ >$this->data['User']['password'] = > md5($this->data['User'] > ['password']); >if ($this->User->save($this->data)) >{ >$this->Session->setFlash('Your > registration information was > accepted'); >$this->Session->write('user', > $this->data['User']['username']); > >$this->redirect(array('action' => > 'index'), null, true); >} >else { >$this->data['User']['password'] = > ''; >$this->Session->setFlash('There was > a problem saving this > information'); > } >} >} > > > > function login() >{ >if ($this->data) >{ >$results = > $this->User->findByUsername($this->data['User'] > ['username']); >if ($results && $results['User']['password'] == > md5($this- > >data['User'] ['password'])) >{ >$this->Session->write('user', > $this->data['User']['username']); >$this->redirect(array('action' => > 'upload'), null, true); >} >else { >$this->set('error', true); > } >} >} > > > > function logout() >{ >$this->Session->delete('user'); >$this->redirect(array('action' => 'login'), null, true); >} > > >function index() >{ >$username = $this->Session->read('user'); >if ($username) >{ >$results = $this->
Problem in simple file upload
Hi I am following this uploader plugin to implement simple file upload on my site: http://www.milesj.me/resources/script/uploader-plugin but the problem is that when I press the upload button call to a unknown action add is made, I dont have any action by the name of add, here is my code: After log in user is directed to index.cpt which has the option to upload score: / index.cpt Hello, Welcome to Game Web Site link('Downloads',array('action'=>'downloads')); ? > link('Upload Score',array('action'=>'upload')); ? > link('logout', array('action' => 'logout')); ?> On clicking Upload score link upload action is called upload.cpt // create('User',array('type'=>'file')); //echo $form->file('File'); echo $form->input('aiman', array('type' => 'file')); //echo $form->submit('Upload'); echo $form->end('Upload2'); ?> now when I press upload2 button I get the following error: Missing Method in UsersController Error: The action add is not defined in controller UsersController Error: Create UsersController::add() in file: app/controllers/ users_controller.php. /// Here is my controller: data)) { $this->data['User']['password'] = md5($this->data['User'] ['password']); if ($this->User->save($this->data)) { $this->Session->setFlash('Your registration information was accepted'); $this->Session->write('user', $this->data['User']['username']); $this->redirect(array('action' => 'index'), null, true); } else { $this->data['User']['password'] = ''; $this->Session->setFlash('There was a problem saving this information'); } } } function login() { if ($this->data) { $results = $this->User->findByUsername($this->data['User'] ['username']); if ($results && $results['User']['password'] == md5($this- >data['User'] ['password'])) { $this->Session->write('user', $this->data['User']['username']); $this->redirect(array('action' => 'upload'), null, true); } else { $this->set('error', true); } } } function logout() { $this->Session->delete('user'); $this->redirect(array('action' => 'login'), null, true); } function index() { $username = $this->Session->read('user'); if ($username) { $results = $this->User->findByUsername($username); $this->set('user', $results['User']); } else { $this->redirect(array('action' => 'login'), null, true); } } function downloads() { } function upload() { if (!empty($this->data)) { if ($data = $this->Uploader->upload('nam')) { // nam is the file name //var_dump($this->data); print ''; $this->redirect(array('action'=>'login'),null,true); } } } } ?> Please Help me to uplaod this file . Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Newbie file upload question
If your getting started with file uploads looking at existing code could help you get started - otherwise you should ask a more specific question :) its simple so long as you don't use swfupload; here are some links http://tv.cakephp.org/video/jasonwydro/2011/01/29/cakephp_1_3_-_meio_image_upload_resize_gallery_tutorial https://github.com/webtechnick/CakePHP-FileUpload-Plugin https://github.com/josegonzalez/uploadpack http://www.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_cakephp http://bakery.cakephp.org/articles/webtechnick/2009/02/10/file-upload-component-w-automagic-model-optional - S On 31 January 2011 20:00, Paul Wheatley wrote: > > Hi, > Very new to CakePHP and my first post here, I am loving Cake so far but > have run up against a small hurdle. > Can anyone point me in the direction of instructions on creating a form > with a file upload field? It's for a registration form where the user > uploads normal stuff (name, address, etc...) and an image or logo of their > company. > From what I've seen of Cake so far I think it should be simple enough but I > can't work it out, can anyone help? > Paul > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Newbie file upload question
Hi there This should be helpful: http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/ thanks On Jan 31, 12:00 pm, Paul Wheatley wrote: > Hi, > Very new to CakePHP and my first post here, I am loving Cake so far but have > run up against a small hurdle. > Can anyone point me in the direction of instructions on creating a form with > a file upload field? It's for a registration form where the user uploads > normal stuff (name, address, etc...) and an image or logo of their company. > From what I've seen of Cake so far I think it should be simple enough but I > can't work it out, can anyone help? > Paul -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Newbie file upload question
Hi, Very new to CakePHP and my first post here, I am loving Cake so far but have run up against a small hurdle. Can anyone point me in the direction of instructions on creating a form with a file upload field? It's for a registration form where the user uploads normal stuff (name, address, etc...) and an image or logo of their company. >From what I've seen of Cake so far I think it should be simple enough but I >can't work it out, can anyone help? Paul -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: File upload
On Tue, Dec 28, 2010 at 3:47 PM, Ryan Schmidt wrote: > > On Dec 28, 2010, at 09:44, Leandro Montero wrote: > >> In $this->data there is nothing!! I mean the file upload array doesn't >> exist! > > If there's *nothing* in $this->data, i.e. no files, no other fields, then > that means the size of the file you uploaded exceeded PHP's maximum POST data > size. You can change this setting in your php.ini. I think that's the likely issue, also. Note that this is different than the max upload size, though. If that were the case, $this->data would be there but the upload error would show that the file upload size was exceeded. And you should start debugging this from the add action in your controller. Make sure that $this->data has what you expect before checking the downstream methods you're calling. Add die(debug($this->data)) to your actions to see what (if anything) has been received by the server. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: File upload
On Dec 28, 2010, at 09:44, Leandro Montero wrote: > In $this->data there is nothing!! I mean the file upload array doesn't > exist! If there's *nothing* in $this->data, i.e. no files, no other fields, then that means the size of the file you uploaded exceeded PHP's maximum POST data size. You can change this setting in your php.ini. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en