Changelogs: Uploader v4.0.0
A new version of Uploader has been released, version 4.0.0. 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: 4.0.0
Tested On: PHP 5.4
Requires: PHP 5.3
Commit Hash: f4d115ff504abdb8b1c7e508ae530300ef53409c
Changes:
- Updated to use Composer extensively
- Updated to use Transit and AWS SDK internally
- Uploader and S3 classes have been removed (uploading is done purely in the model layer)
- Transformations can be applied to the original file or used to create new files
- Transformations now support the following options: nameCallback, append, prepend, uploadDir, finalPath, overwrite and self
- Added Model::deleteImages($id) to delete uploaded files and not the record
- Added automatic file deletion when a record is deleted, or a path is being overwritten with a record update
- Added built in support for file uploading and importing (local, remote or stream)
- Added rollback file deletion if the upload process fails
- Added Model::beforeTransport() callback
- Added logging for critical errors
- Added AWS S3 and Glacier transport support
- Added type and mimeType validation rules
- Improved the error handling
- Improved file renaming and moving
- Removed config and mime type mapping
- Removed Test and Vendor files
- Option name was renamed to nameCallback
- Option importFrom was removed as importing is built in
- Option s3 was replaced with transport
- Option metaColumns had keys renamed
- Options baseDir and uploadDir were replaced with tempDir, uploadDir and finalPath
- Options maxNameLength and saveAsFilename were removed
- View the updated documentation for help
32 Comments
For those wondering how it is done, just point the autoload.php file to load from the right location:
from:
to (for me):
Miles, if I am misleading someone, please correct me.
Thanks again for your help!
http://milesj.me/blog/read/using-composer-in-cakephp
Dependencies are then installed into the Vendor and Plugin folders.
So, to all those people new or not so familiar to Composer, use it and DO NOT download a single line of code from GitHub in order to have this great plugin working. Really, if you already have composer running. It should take less than 5 minutes to install.
Miles, thanks for the input. I have it running correctly this time!
I installed uploader plugin but i have a following problem and what i missing or fault.
Class 'Transit\Transit' not found
I used Composer to install the dependencies, it created the "vendor" folder and inside it has created 2 folders (composer and mjohnson), and 1 file (autoload.php). Of course, jmohnson has a "transit" folder and so on..
I have seen the Installation instructions more than 20 times now, and looked all over the internet and popular help sites. but I am having the same error:
I have seen this a couple people with the same problem here. But no pointers.
Do you think you could let us know what we are doing wrong? Just a simple pointer will be greatly appreciated.
Thanks in advance!
SecBin
If that doesn't work, then you'll have to debug the autoloader.
Thanks.
How to use transit script, where to copy the folder etc as it give me following error .
Class 'Transit\Transit' not found
Second, can you give us some tips about video uploads? File types, size limit...I saw only examples with images.
Best wishes.
Thanks,
Matt
I've installed your plugin, but when I try and upload an image I get the following error:
Error: Call to undefined function Transit\finfo_open()
File: C:\Users\matthew.a.croxon\Documents\Coding\ArtPortfolio\app\Vendor\mjohnson\transit\src\Transit\File.php
Line: 338
Any ideas?
Thanks,
Matt
If it does, that would be great and I would be glad to hear about it.
thanks for your hard work to make Cake a piece of cake.
Michael
Or maybe I'm missing something.
Yes. I've rechecked my folders and are writable (chmod 777).
Thank you for the fast reply.
I've setted up an absolute path to the folder for uploaded files like in the exmples you pointed me to and I still have the exact same problems...
At the moment I'm running into one last problem that I can't seem to figure out, which is mimeType validation. Without it it everything is working fine, however with the following code in place in the relevant model:
Results in the error: "Sub-type image/jpg does not exist". The code is straight from the example validation with "image/gif" changed to the two jpeg mime types. Any thoughts?
Now after starting to work with it I've noticed it will properly overwrite the files if it's of the same extension, but if the extensions are different from each other the older files will still exist.
For example, I tried uploading a cover to a game in my app. It automatically renamed the cover by the primary key it has in my DB, being 10, so the file was renamed to 10.jpg. Now I edited the game and uploaded a .png image which was uploaded as 10.png, but the .jpg still exists.
Now I can probably hackfix this in the beforeUpload hook something like this:
But how neat is this?
I've been looking for a oportunity to upload a file with cakephp 2.1 and have found this page here with google.
I'm a really noob in PHP and CakePHP so unfortunately I really don't know how to use this plugin.
I've programmed a webapp with CakePHP 2.x and need the upload function. The webapp is installed on a webserver where I can't use shell or anything like this (command line etc.).
So I don't really know how to install this plugin because I need the composer and really don't know how to install the composer without comand line etc.
Can somebody please help me and give me a good guide through the installation of this plugin?
Thnx
I've been looking for a oportunity to upload a file with cakephp 2.1 and have found this page here with google.
I'm a really noob in PHP and CakePHP so unfortunately I really don't know how to use this plugin.
I've programmed a webapp with CakePHP 2.x and need the upload function. The webapp is installed on a webserver where I can't use shell or anything like this (command line etc.).
So I don't really know how to install this plugin because I need the composer and really don't know how to install the composer without comand line etc.
Can somebody please help me and give me a good guide through the installation of this plugin?
Thnx
http://milesj.me/blog/read/using-composer-in-cakephp
This gave me the following results:
This created a 'cake-uploader-4.0.0' folder within Plugin/Uploader and also a 'vendor' folder in which all of the dependencies were installed. So some things were downloaded but still, this doesn't make the plugin functional. While it now loads the AttachmentBehavior with the code snippet you supplied, it currently screams it cannot find the Transit folder.
Should I manually place these files somewhere? Or is this supposed to work automagically?
Thanks a bunch for your time.
Mike
Or you can just use the string "crop" instead of the constant (it even says that in the PHP comment).
And another problem, you should be using Composer when installing the plugin -- not manually downloading the files. Composer How To
I've tried using the 4.0.0 version of the Uploader plugin. I downloaded the files, put them in Plugin/Uploader and in my bootstrap.php is the CakePlugin::loadAll() so I assume it should be loaded.
Though when I create an $actsAs configuration it gives me the following error:
My code looks like this:
Any ideas as to why it is not functioning?