Uploadify
26 Aug
The Uploadify module is a FormField object that handles a variety of file upload features, and integrates easily into any frontend or CMS edit form. Features include:
- Bulk uploading
- Upload progress
- File type filtering
- Upload folder selection/creation
- Import files
- Drag-and-drop reordering
- Amazon S3 storage integration
SVN: http://carlinowebdesign.svn.beanstalkapp.com/modules/trunk/uploadify




really amazing new addition to the silverstripe modules family!, i’ll start using it for some imagegallery modules
i just can’t wait to see it bundled inside DOM
Hi again,
I’m translating Uploadify to Dutch and found two issues:
In FileUploadField.php on line 68 and MultipleFileUploadField.php on line 83 there’s the conflicting name SUCCESSFULADD.
In the file AttachedFiles there’s the conflicting name REMOVEANDDELETE (used for both ‘Remove’ and ‘Remove and delete’).
That’s about it. Love using it in the FileDOM.
Hi, Ruurd,
Thanks for working on this. I’ve resolved the entity conflicts with:
SUCCESSFULADDSINGLE (FileUpload.php)
SUCCESSFULADDMULTI (MultipleFileUpload.php)
REMOVE (AttachedFiles.ss)
REMOVEANDDELETE (AttachedFiles.ss)
Also, could you please re-submit the Postale translation? My mail has been down, and I assume I missed it!
Glad I can help a bit.
I resend the Postale translation and the send the Uploadify translation.
Is Uploadify meant as a replacement for swfupload?
Yeah, I’m not supporting SWFUpload anymore.
I just used ImageDataObjectManager and it said it required SWFUpload so I had to re-add it
Just updated DOM so that it requires SWFUpload OR Uploadify.
How to do it?
Let’s say I have a folders called a b and c under my assets folder. When I go into Files & Images, click one of these folders and then “Add files to a” then a new assets folder is created under my existing assets folder and a new “a” folder added under that. This is using uploadify r483. Is this problem peculiar to me for some reason, or is everyone else getting it to?
As a temporary fix I’ve added the following line to the start of UploadifyField::CurrentUploadFolder() to my own copy of the code:
$this->uploadFolder = preg_replace(‘|^’.ASSETS_DIR.’/|’, ”, $this->uploadFolder);
Ideally the assets/ part shouldn’t be being used as part of the uploadFolder so where-ever it is being set is where it would need to be fixed properly.
I can’t replicate this, Chris. Can you do it on the demo site? http://dataobjectmanager.carlinowebdesign.com
Hmm I was a bit worried it was only going to affect me… I do have my cms/sapphire/modules directories symlinked so perhaps that is part of the issue. I haven’t tried this on a regular install of SS yet. What’s the login/password for the demo site. Thanks!
admin/password
FWIW, I have symlinks, too.
To replicate (and I’ve tried this in both Chrome and Firefox and it does it).
1. Go to Files & Images
2. Click on one of the folders
3. Click “Add files to ‘X’”
4. Close the Facebox dialog.
5. Reload Files & Images
6. Look at the treeview and you’ll see an assets folder with subfolder named the same as the one you just looked at.
I could see as soon as I’d logged in that your demo site had the problem as well because there was an additional assets folder.
If you expand assets, click one of the sub folders and then add files you’ll end up with another level again.
As soon as the dialog opens you’ll see the extra levels in the select box as well, e.g. the selected option will be assets/assets/Folder/
Thanks. I remember going through this with FileDOM, too, censoring user input to make sure ASSETS_DIR wasn’t included in the path. It looks like AssetManagerFolder needs to be updated to set uploadFolder to the filename, minus “/assets/”.
I think that’s a huge limitation of the framework, by the way. The path of the file is saved with the /assets/ path, but if you refer to it later, it’s relative to /assets/. It seems to me there should be a method in the Folder class like getRelativePath() or something. The Filename property is almost useless for folders.
Another great module!
I’ve been playing around with it today and had a tiny request. I find it difficult to see which tab (Upload new / Choose existing) is selected. I’ve altered uploadify.css (line 68) to read
div.tabNavigation ul.navigation li a {… margin:0 1px -1px; … }. The -1px bottom lowers the tabs and gets rid of the dark gray separation line between the selected tab and the form area.
PS. Where would you prefer to have bug reports / suggestions? On your blog here or the bug reports thread on the SilverStripe forum?
I notice that video uploads (flv,mpg,etc) no longer work when uploadify is used. When I remove the module and use swfupload all works as expected. Not sure if this is a bug, or I’m missing something obvious.
Hi, Andy,
I’m thinking about getting rid of the whole “upgrading” functionality in FileDOM. Did you try casting these relationships as “FLV” instead of “File”?
Wow, glad I asked. I would’ve been digging forever. That worked.
Haha.. Glad it worked. The ever-moving target that is the DOM codebase.
Hi Uncle Cheese,
I’m having problem with this module, it says
“Fatal error: Class ‘SimpleTreeDropdownField’ not found in G:\sites\mysite\uploadify\code\UploadifyField.php on line 447″
can you help me?
Thanks
Hi, Theo,
Make sure you have DataObjectManager installed.
Thanks man!
But how can i show my files in the templates?
In DataObjectManager i just have to put:
$Image
And SS print’s a complete image tag
The blog cut off the control statement ()
UC… I’m trying uploadify (latest version from SVN) and everything appears to work, but the file never attaches. I just see: “No file attached”
I am doing an Image, and have has_one of image and not file, I assume this is ok. Here is the pastie: http://pastie.org/1169482
I’ve tried upload and existing, same result.
While I got your attention, is bedrock your next module? Just saw it on SVN and was curious. Thanks for what you do!
Interesting. I am running on a Windows stack, IIS and MSSQL Server. Have you ran on this stack before?
This is my first time myself (w/ SilverStripe). Anyway, looks like MSSQL does not like SortOrder as a field name, I’m getting some errors. Maybe I’ll try patching that to a different name and see if that fixes it.
No Luck, it’s not the word SortOrder, because I changed it to OrderIndex and I’m still getting errors.
I though it was because there are missing double quotes around SortOrder, so I patched in double quotes and that didn’t solve it. This is the error I’m getting:
[User Error] Couldn’t run query (42000, 8127, [Microsoft][SQL Server Native Client 10.0][SQL Server]Column “File.OrderIndex” is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.): SELECT COUNT(*) FROM “File” WHERE (“ParentID” = 1) ORDER BY OrderIndex ASC: [Microsoft][SQL Server Native Client 10.0][SQL Server]Column “File.OrderIndex” is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
Ok, I solved the original question,
MSSQL has strict quoting rules.
Here is a patch, Replace line 113 of FileUploadField
with:
if($files = DataObject::get($class, “\”{$class}\”.\”ID\” IN (“.Convert::raw2sql($val).”)”)) {
However the when going to Files And Images, I get the other error and it has to do with MSSQL and using an aggregate, and trying to access a column that is not within the aggregate, see:
http://www.sql-server-performance.com/faq/column_not_contained_in_aggregate_or_group_by_p1.aspx
Any ideas how to solve that one?
Hi DRye,
Did you ever get Uploadify working in IIS? (win 2008 R2, IIS 7.5)
I have tried installing both SWFUpload and Uploadify without any success. (without using DataObjectManager)
Hi Uncle Cheese,
FYI -
As per the basic documentation, I’m just creating a simple page with with a has_one File, and trying this code:
$fields->addFieldToTab(“Root.Content.File”, new FileUploadField(‘AttachedFile’,'Upload a file’));
Whenever I add the field the page crashes in the admin area. I’m in Dev mode with error logging sending to a text file, however no logs are produced. A blank javascript popup message is displayed and generic “error loading page”
Really appreciate any help you can give.
Thanks
Tim
Hi UC, sweet, work, thanks for releasing it
I’ve been playing around trying to limit the file size of the upload but can’t find a reliable way to do it – no matter what I do, it seems to allow any size file through. Can you give me any pointers here?
Thanks
Hi, Mike,
Looks like a bit of a bug. I’ve fixed that for you and checked it in to the trunk. You can now do: $your_uploader->setVar(“sizeLimit”, 1000000);
Hi UC,
When I install DOM and Uploadify on a 2.4.1 installation, and I use an ImageUploadField, from that moment I always get the popup: “Your changes have not been saved. Continue? etc”.
I am sure I do save and publish so it must be something else. I only happens after adding those modules? Any idea?
Cheers,
Oscar
I am having exactly the same issue :s
Been working on this one for weeks. Finally got a fix in today.
Ah cracking! What was the cause? Do you know when will you be able to provide a new download?
Yeah, it’s in the trunk as of now, so you just need to run an SVN update. I think the zip file is built at 3AM every morning if you want to wait for that.
Is there any plan to extend S3File to include standard File and Image features like SetWidth, and integrate it with the WYSIWYG Image button?
No, they’re two different animals, unfortunately. If PHP supported multiple inheritance, we could do that, but since it has to descend from only one class (DataObject), the only way to get those features into S3File is by copying and pasting them in.
Thanks unclecheese, I will consider doing exactly that… though I’m sure there’s more to it than copy/paste – eg. storing the image from S3 locally, resizing, and sending back to S3?
Yeah, it’s a tall order. That’s why I didn’t even consider it for this feature.
Hi,
I’m having a few issues with this module:
1. On every page with the field I get the following error when I try to navigate away from it whether I have made any changes or not:
Are you sure you want to navigate away from this page?
WARNING: Your changes have not been saved.
Press OK to continue, or Cancel to stay on the current page.
2. Is it possible to make the the dropdown on Choose Existing show the folder Title, not the actual name on the filesystem (I have an ID on the folder on the filesystem, but have a name which is matches the page name for the user to see)?
3. Is it possible to set which of the folders should be selected by default in the Choose Existing tab? I would like people to be able to switch images in a directory, but not choose any from all over assets.
4. I seem to have a folder showing in the Choose Existing drop down (assets/new-folder), but this does not exist on the filesystem?! Actually, now I look again, there seem to be two!
Any help would be gratefully received!
p.s. donation made for all your continuing efforts.
Richard, I have the same (#1) issue you have. If you figure it out let me know. Nice work supporting Aaron and all he does, I’m sure he appreciates the donation.
Hi, Richard,
This bug was fixed last week. I posted a comment here and tweeted about it. That was the best way I knew to communicate the update to everyone!
Hi, I have been using the swfupload with the dataobjectmanager and I am having many issues, so I would like to switch to Uploadify. But first I would like to know if it gives the user the possibility to edit image properties once they have been uploaded – for example if you add new attributes to an image class (e.g. category, price), can these attributes be edited by the user?
Hi, Mark,
Uploadify is an uploading interface. To manage the File records themselves you want to use AssetAdmin (Files & Images) for that.
Ok thanks unclecheese. Good work!
Hello Uncle Cheese.
First off all. Thanks a Lot for your Silverstripe Modules. It was saving me from a lot of work, so you helped me a lot.
After installing your uploadify module i encouter a strange problem…
In The Files&Images Manager of the CMS, i do no longer see files which are placed directly into the root folder /assets/
The WYSIWYG of the CMS is putting images there if you don’t choose a subfolder.
I’m not sure if it’s really your module, i just recognized the problem immediately after installing it.
(i updated DOM at the same time btw)
Maybee others have that problem too?
Thanks a lot
Is there a way to integrate uploadify with Pixlr module?
Hi UC,
I have a problem since moving my code to live server. When I use AssetAdmin with Uploadify the file uploads fine and then HTTP Error appears. This is in your documentation written as the most common problem…
I start as suggested as Wireshark capture and the only weird thing i notice is that a 302 is returned. It is redirecting to /Security/Login?BackURL=/admin/assets/EditForm/fiels/Files=/UploadifyForm/field/UploadedFiles/upload=ctf…..etc etc
Do you have any clue or can you point me in the right direction to search further?
Thanks
Oscar ‘Ozzi’
After more investigation and Googling i found my problem is Mac specific. And after a test: it is!
See:
http://www.uploadify.com/forums/discussion/1527/http-302-error-on-mac-with-v2.0.1/p1
Some people suggest return a 200 in the header of the redirected file? But i have no idea where to do that.
Any suggestions?
Also strange: on my dev sever (php 5.1) I don’t have this problem, but on my clients server (php 5.2) I do have it.
Cheers,
Oscar
I see that there is a threat about this on http://silverstripe.org/dataobjectmanager-module-forum/show/14597?start=24#post296469
so will continue there
I had the same problem after doing a new php build for mac from source, and found that new php.ini had session.auto_start and session.use_only_cookies set to on – I turned em both off and now uploadify works again, however not sure which one is the issue
Hi Aaron. Thanks so much for the great work.
I’m really interested in somehow integrating this with the blog front-end editing. Right now, one of the most serious shortcomings of blog is that the image and media upload button in the tinymce editor only allows you to upload from a URL (and not from a local file as is the case in the CMS). I’m guessing you or others have tried this or thought about it. Do you have an example or a working site that does this?
Thanks again!
Very great module.
Thanks very much.
Unfortunately I get a javascript error with IE7.
As IE7 is so dumb, I only get part of the error.
It says:
“‘FileDataObjectManager_Popup_UplodifyForm_UploadedFilesU…’ is undefined”
If I select a file and press “Continue” I can upload a file anyway.
But the normal user would be confused because he doesn’t see the file selected in the PopUp.
Any idea?
TIA Stephan
getting an IO error on uploads when I try to add album cover using mainline versions of DOM, image_gallery and uploadify.
have adjusted mod_security in .htaccess as instructed but it does not seem to help.
any ideas?
Hello,
Having problems with the Choose Existing… tab when loading a big folder >200 files (runs out of memory). The memory limit is already 32MB (which is usually enough for SS), so I was wondering if there is a way to paginate it? Thanks!
We are using the Multiple Image upload field and would like to make it sortable, is this possible we have declared the object as sortable but this does not seem to work, when we dev build the extra sortable attribute gets added but the interface does not allow the images to be sorted. Any help or advice would be great, I have searched the documentation it says it supports Drag and Drop reorder but there is no help on implementing it.
Again UC thanks for another awesome module.
is uploadify support to exit out of the SS admin area on a new page.
it works but seems strange as you then have to refresh or go back to /admin at the end of upload process.
otherewise works great
Hi Uncle Cheese !
Everytime I upload a file with uploadify (in a FileDataObjectManager nested in a ModelAdmin Managed Model) I get a javascript alert showing me a number (probably the ID of the file). It makes Firefox crash.
Any idea ?
Hi, VRoxane,
You have some whitespace in your PHP somewhere. Make sure the very first characters of every PHP file are )
The first characters are closing parenthesis ?
I checked the three files (Model Admin, Data Object and FileDOM) and removed all blank lines. I still get the error…
Sorry, wordpress stripped out all the code. You have whitespace in your code somewhere. Make sure you havent closed any PHP tags.
I guessed that and removed every blank line…the alert did not show up again !
I have another problem with the “refresh” function at the end of an upload. I put a die in it and it didn’t change anything.
I used Charles and the debug stuff :
http://www.silverstripe.org/dataobjectmanager-module-forum/show/16806#post302874
Hope you can shine your cheesy light on me again
s’il te plait oncle from’ton !
Hi Uncle Cheese,
Just had a quick question about the MultipleImageUploadField. Upload works great, however, when I attempt to iterate over the images in my ss template I don’t seem to have the Image operations such as CroppedImage, setWidth, etc. even though I extended the Image class using a data type I created and referenced in the $has_many static variable. Am I doing something wrong? Any help would be greatly appreciated.
Hi Jonothan, I asked Uncy Cheese about this in an earlier comment and he responded that it would a lot of work, which is understandable… I would personally be prepared to make a sizeable donation to get this working!
Excellent module!!! Huge step for SlverStripe… Thank you
Hey guys,
Just wondering if anyone else has experienced the issue of not being able to upload files when using Uploadify in Firefox 4.0.1?
I have an ImageDOM and whenever I click on “Add Image” and the “Upload Files” button in the popup in Firefox 4.0.1, the file browser window doesn’t open at all, but works in other browsers?
Hi Uncle Cheese,
i try to use the SimpleHTMLEditor and the Uploadify interface in same Popup… but it doesen’t work.
The Uploadify in showing but the SimpleHTMLEditor field do not.
Is there a way to use them both in combinition?
Thanks a lot.
I want to use the field to only upload/import pdf-files but I do not succeed.
Filetype Restriction works on the upload part but not on the import section. Then I tried to disable the import section but it seems $allowImport is not used at all.
Is there another possibility?
Thanks for your attention.
Best regards
stephan
Hi, I am using Silverstripe 2.4.5. I have uploaded the “uploadify” directory under my “www” folder. I made a dev/build after uploading. DataObjectManager sees that there is an uploadify module. However, when I try to add new images none of the icons(edit,delete,rotate,…) appears on my CMS. Also after uploading the images, a message appears telling “Closing…”, but it doesnt close by itself. Moreover, When I try to see images uploaded, I can see only their name, when I click on the Edit link I cannot seee any image content.
I appreciate your elp in advance. Sorry to write such a long message
Hi, i need some some help with the ImageUploadField.
in modeladmin i am managing companies. the logo of a company has to be uploaded in “assets/tmp” first.
$field_Logo = new ImageUploadField (‘Logo’, ‘Logo’);
$field_Logo->setUploadFolder(‘tmp’);
in onAfterWrite() i want to move the logo to a new folder that has the ID of the company in its path, like e.g.
“assets/companies/29/newlogo.png”
But i dont know how to access the uploaded logo in onafterwrite() in case of adding a new company.
thanks
To put my question in a nutshell:
Do you think it is possible to have something like this:
$field_Logo->setUploadFolder(‘companies/$ID/fotos’);
This should create an Folder for the company, if its not yet existing.
But it should be possible to define this also when you add a new Company. I know that the company does not have an ID before it is saved. But maybe uploadify can put the file first in a temporary folder and onafterwrite move it to the folder “assets/companies/179/fotos/” (Do you think that this could be included in the uploadify module?)
thanks
I don’t think it’s any that’s appropriate for the Uploadify module, because it’s more business logic that you would handle in your DataObject class. Look at ImageGallery for examples of how it is done. You just have to write to the associated folder every time the object saves in order to account for changes in the data (e.g. the company name).
great mod! one bug i’m running into: uploading .JPG files from a PC, the image uploads and creates the 100×100 cropped image, but, the image is not visible from a browser (http://mydomain.com/assets/Uploads/abc.JPG, same with resampled image).
it works from a PC if i change to .jpg before upload. However, from a mac, it changes the .JPG to .jpg upon upload.
really weird! please advise.
Just some feedback for uploadify;
The icons have changed for the Uploadify module.
Feedback from some clients suggest it should be either a 2 stage process (as a question)? Or show more descriptive text before clicking the link.
It seemed to work well before with the text next to the link -the text only available on rollover takes too long to appear.
Hi, Matt,
Thanks for your feedback. What do you mean by “The icons have changed?” Which icons?
Hi
I’m having problems with uploading files to a website. For some reason he doesn’t recognize the images anymore and shows a document instead of the image (bmp?).
It has always worked in the past.
Is this something you recognize?
regards
Mark
That usually happens if you’ve casted the file as ‘File’ rather than ‘Image.’
Hi UC, the site I’m building atm uses jQuery 1.7.1. I’m using uploadify on the frontend for single image upload, and the module Requires:: jquery.js from the sapphire 3rd party folder.
Obviously including 2 versions of jq on the page is never a path to happiness, so using Requirements::block I’ve removed sapphire/3p/jq.js. But now my uploadify field is not working.. dang!
(that is, the browse button is not replaced and nothing is uploaded at all.)
Have you come across this, or better yet a way around this? It’s weird as your module is using the latest uploadify.js which according to uploadify website has jq 1.4+ support, but when I change which jquery is included on the page it breaks/works like clockwork. I’d change to just using the sapph/3p jquery.js but it’s incompatible with a few other bits on the page.
Any help or thoughts would be appreciated. Thanks for all the great modules.
Cheers
You know what, I finish typing that and go back to keep trying, and all of a sudden with both jquery.js included on the page everything is working. LolSigh.
Still I’d rather not maintain two versions of jq on the page for too long, if you’ve got any thoughts on this I’d be keen to hear them.
thanks!
Hi unclecheese
Could you give me some idea of where to start with converting the uploadify module into using UploadiFive (HTML5) instead of Uploadify?
thanks
Colin