CakePHP change a view to have an image upload field in it

# add array('type'=>'file') to the…

Login

Blog History

# add array('type'=>'file') to the Form->create method
< ?php echo $this->Form->create('Map', array('type'=>'file'));?>
	
< ?php __('Add Map'); ?> < ?php # most fields are just normal automagic text/numeric/boolean fields echo $this->Form->input('name'); echo $this->Form->input('locality'); echo $this->Form->input('suburb_id'); echo $this->Form->input('map_type_id'); # change the field you want to become the upload field to have a file type # if you want a label you also need # if you are changing a field you need to change the model too # because it passes an array to cakephp echo $this->Form->input('upload', array( 'type' => 'file', 'label' => "XCF File")); echo $this->Form->input('source_image'); echo $this->Form->input('thumb_image'); echo $this->Form->input('tiled_image'); echo $this->Form->input('division_id'); echo $this->Form->input('dir'); echo $this->Form->input('mimetype'); echo $this->Form->input('filesize'); echo $this->Form->input('active'); ?>
< ?php echo $this->Form->end(__('Submit', true));?>

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.