Search code examples
cakephpcakephp-2.0formhelper

How to use FormHelper postLink to upload a singlefile in Cake 2.3


This is the postLink method of FormHelper in Cake 2.3.

http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::postLink

I was wondering if I can use it to upload a single file instead of using it for deletion.


Solution

  • No

    That function creates a form that looks like a link. Uploading a file can be achieved with appropriate usage of the form helper, e.g.:

    echo $this->Form->create('User', array('type' => 'file'));
    echo $this->Form->file('avatar');
    echo $this->Form->submit();