Skip to content

nima-rahbar/CakePHP-2-FileHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

CakePHP-2-FileHandler

CAKEPHP 2.x File Upload Handlers Component.

Usage:

Follow description below in your action's controller.

  1. Add
  2. $this->request->data['Model']['fieldname'] = $this->FileHandler->fileAdd(
      $this->request->data['Model']['fieldname']
    );

    This will save new uploaded file & if file had no errors return file name.

  3. Edit
  4. $fields = $this->Model->read(NULL, $id);
    $this->request->data['Model']['field'] = $this->FileHandler->fileEdit(
      $fields['Model'],
      $id,
      $this->request->data['Model']['field'],
      $fieldname(optional)
    );

    This will unlink old file (if existed) & save new uploaded file & return new file name.

  5. Delete
  6. $fields = $this->Model->read(NULL, $id);
    $this->FileHandler->fileDelete(
      $fields['Model'],
      $fieldname(optional)
    );

    This will unlink old file (if existed).

About

CAKEPHP 2.x FileHandler Component

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages