Changelogs: Uploader v3.1

A new version of Uploader has been released, version 3.1. Please download the new tag or view the documentation. If you have any questions, be sure to send me an email or comment on this post. If you run into any problems, be sure to report an issue on the Github repository.

Version: 3.1
Tested On: PHP 5.3, CakePHP 2.0.3
Requires: PHP 5.2, CakePHP 2.0
Commit Hash: a0d0cbf3ac1062a31facab1b021969dcb39df49d
Changes:

  • Added append and prepend support to Uploader::upload() and AttachmentBehavior
  • Added support for slashes within append and prepend options to allow for folder organization
  • Fixed a bug with FileValidationBehavior::extension()

Codebase Upgrades: Upgrading Uploader v2.8 to v3

The Uploader plugin has upgraded major versions from 2.8 (CakePHP 1.3) to 3.0 (CakePHP 2). Since this is not a backwards compatible change, the 3.0 version can only be used in CakePHP 2.

No more UploaderComponent

During the conversion process, the primary change is that the UploaderComponent was removed and turned into a stand-alone vendor class. This was done to further encourage the use of the AttachmentBehavior. Because of this change, you will need to manually initialize the Uploader in your Controller::beforeFilter() (only if you were using the component). The property settings are now passed as an array through the constructor.

// Before
public function beforeFilter() {
	$this->Uploader->tempDir = TMP;
}
// After
public function beforeFilter() {
	$this->Uploader = new Uploader(array('tempDir' => TMP));
}

By instantiating the class to $this->Uploader, all of the old code should still work as normal. This change also allows the possibility to use the Uploader anywhere in the application.

No more S3TransferComponent

The S3TransferComponent was trying to do something it shouldn't have. The component was removed in favor of the Vendor/S3 class that provides far more functionality. The AttachmentBehavior has also been updated to use the S3 class instead of the component.

Certain methods are now static

The bytes(), addMimeType(), checkMimeType(), mimeType() and ext() methods are now static.

Those should be the only changes you would need to make to support the new version. There are quite a few other changes, so be sure to check out the changelog and to also check out the updated documentation.

Cupcake and Uploader plugins updated

I want to thank everyone who has tested my forum plugin, and thanks again for all the people who reported bugs and features! The plugin is coming along nicely and I have a few features planned for the future. Cupcake has been updated again to provide more multi-byte character support and fix all the reported bugs. Additionally, I have added a quick-reply feature which can be enabled or disabled through the settings.

The Uploader plugin has also received an update, for there was a major bug, the validation never worked! This was my fault because it seems like I removed a reference variable to the parent model (&$Model) which would never update the primary model outside of the behavior, and in turn the validation never worked. I also updated the plugin with multi-byte support.

Uploader Plugin officially released!

For the past month I have been talking about CakePHPs lack of a built in uploader component or mechanism, and how I wanted to build one. Well wouldn't it be great if I actually did build it? Oh wait, what is this? I did build one? Yes. Is it released? Yes. May I use it? Of course! The Uploader is primarily used as an all purpose file uploader and was built to not interact with a model/database. Here is a quick rundown of the plugin.

The plugin comes bundled with an uploader component and a validation behavior. The component is used to upload the files to a destination, resize or generate images, validate against mime types, log errors, scan for viruses and more. The behavior is used to add validation rules to a model to check against image uploads.

A big thank you to http://mark-story.com/ and Matt Curry for beta testing and giving input and ideas.

- Download Uploader v1.3 and view full documentation