Search

A new Extension, “Mass Upload Utility” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

Updated for Symphony version 2.2.1 and completely reworked

https://github.com/scottkf/massuploadutility

For versions <2.2 please use v0.9 of the MUU

http://github.com/scottkf/massuploadutility/tree/v0.9

I'm going to assume the newest version of MUU should work for versions > 2.1, but I haven't tested it, if it does let me know!

Overview

This allows you to upload multiple files (via HTML5), and will add an entry for every file you upload. The rest of the fields are filled in with default data you can specify. This works with the default Upload Field, Unique Upload Field, S3 Upload field, and perhaps others; those are the only ones I've tested.

This came about because a client asked to upload 1000 images to a gallery easily; I didn't ask questions.

v0.9.5

  • No longer clears files from the input[file] box if failed
  • Under the hood changes, no longer duplicates Symphony code, uses a custom event to add entries. Inspiration and thanks to Nick Dunn and his REST API extension!
  • Will highlight which fields have problems and display errors on them (except the upload field) This may get obnoxious and I might turn it off. This is instead of showing them in the queue list. It's customizable by changing a variable in the javascript.

v0.9.2

  • Added ability to exclude sections and users (I stole this from Craig's tracker extension)
  • Forgot to localise a couple strings
  • A quick blurb to let the user know they can upload multiple files
  • Checking for HTML5 support
  • Added support for using variables in any other input field, like {$number} will dynamically change
  • When selecting files, they're populated to the queue so you know you queued files

Usage

  1. Go to the index of a section with an upload field
  2. Click the button that says 'Create new'
  3. If there's an upload field, my script will turn on, select multiple files, enter other values as necessary, and click 'Create Entry'

Todo

  • Possibly expand the {$} variables to contain other things (like what?)
  • Refine the UI some

Bugs

  • If more than one upload field is in a section, this will not get used I consider this more a feature.

Issue tracking

Please use the github issue tracker and not the symphony tracker, I don't check it!

Updated extension, you can use the built in Uploadify to upload files now.

Sounds promising. I will look into it as soon as I get the time. :-)

I would love to be able to set a few default values depending on the filename.

Why haven’t I seen this extension earlier?

Awesome extension, mass uploading is one of the features I sometimes find missing in Symphony. Nice that you based it on one of my extensions, but Rowan deserves the credit since I heavily based the Global Parameter Loader on Rowan’s Global Resource Loader…

I think this extension should be able to work with the unique upload field too (or the image preview field).

@phoque: It would be great if all Symphony fields came with an option to specify a default value. Perhaps we can create an extension for that? As an alternative I often use tag lists where I can quickly click an existing value.

Is anyone currently developing this extension? I really need the ability to use the iptc information from within images to populate fields in my section for a client, but don’t know enough about how symphony uses php to be able to do it myself.

If anyone could help with this, or a similar extension, I would be greatful…

It would be great if all Symphony fields came with an option to specify a default value.

I think in this case it should be something the mass upload utility can do: Either a huge form with a preview for each file or a way to derive text input values from filenames.

Is anyone currently developing this extension? I really need the ability to use the iptc information from within images to populate fields in my section for a client, but don’t know enough about how symphony uses php to be able to do it myself.

I guess this functionality should be put into a fork of the file upload field and not in the mass upload utility. It might get even easier if you don’t have to prepopulate other fields with the values but only return them in the XML.

Take a look at /symphony/lib/toolkit/fields/field.upload.php: appendFormattedElement() is the method returning the XML when reading from the database and processRawFieldData() is the function being executed when saving to the database.

Your code reading the IPTC data should go in either one of these.

Also, take a look at one of the other custom upload field extensions on how to wrap it all up into an extension.

I’ve been using this for a while, but don’t use it that often and it seems to work pretty well as is, so I haven’t really gotten around to updating it with new functionality.

However, someone just posted an issue on github saying it doesn’t work with 2.0.7. I haven’t upgraded to 2.0.7 yet so I haven’t come across it yet! I’ll be updating it to work with 2.0.7 in the next week though.

@phoque I’ve had a look at the functions you mentioned, and also read through the massuploadutility code. I would have to modify the extension to do what I need, as the iptc data would need to go into the fields that are called by the extension itself for the user to fill in. I think I have an idea where to do it, but how is another matter…

I have the iptc functions as I wrote them a while ago for another project, but as I’m not used to Classes and don’t understand how Symphony works, I don’t know where to start with this. Also, I’m not actually any good at PHP either :(

Would anyone like to fork this extension to help me do what I need? I would really appreciate it. I really think this would be a very beneficial fork as I know I’m not the only person who would use Symphony if we could achieve this.

This extension doesn’t work in conjuction with the Reflection Field. Not trying to aportion blame, but I think it would be this extension that needs fixing to get it to work.

So when you’re saving a field that’s a reflection type, what happens?

@scottkf There’s nothing in the field when it is saved via the Mass Upload Utility. Everything else works perfectly and stores data as expected, apart from this field.

I would have a delve into it, if I knew more about how Symphony is built, and had the API docs to look at, but alas, we must wait for them.

Thanks for your reply!

@scottkf Any luck in finding solution to the reflection field not populating?

I’m also getting this error when I try and upload:

filemtime() [function.filemtime]: stat failed for /Users/designermonkey/Sites/portfolio/uploads/project-images/DSC_1801.jpg
/Users/designermonkey/Sites/portfolio/extensions/massuploadutility/content/content.inject.php line 517

512             'image/png',
513         );
514         
515         $meta = array();
516         
517         $meta['creation'] = DateTimeObj::get('c', filemtime($file));
518         
519         if(in_array($type, $imageMimeTypes) && $array = @getimagesize($file)){
520             $meta['width']    = $array[0];
521             $meta['height']   = $array[1];

Which I can fix by commnting out line 517.

I read on the PHP manual page for filemtime the following:

I spent some time wondering why I got the “stat failed”, but it was simply due to the fact that I fed the function relative paths. Paths need to be absolute.

Is this possibly the cause?

Edit: On looking at the error thrown, it is an absolute path, should use my eyes! I wonder what is causing it?

I haven’t seemed to figure out what the deal with reflection field is, I’ll have to look at it a bit more.

As for your second issue, that can fail and most commonly fails on files that don’t exist (sometimes this can be overlooked as obvious as it is, and if it doesn’t exist this could mean many other things) and on files that the webserver doesn’t have access to. Those are two quick things to check anyway; filemtime is flakey, especially on shared hosts.

Depending on your use, you probably don’t really need the modified time anyway, and if you really did, you should replace line 517 with

meta['creation'] = DateTimeObj::get('c',trim(shell_exec('<your fav unix command to get the timestamp>')));

Thanks dude! I’ll look into the Unix command route.

Also, the reflection field isn’t an urgent need now, I’ve gone a slightly different route than originally intended, but I would like to use the field for another project.

Cheers!

With reference to the reflection field issue…

This post from the XML Importer thread might shed some light on the problem.

From the quick once over on the github repo, yes, the Mass Upload Utility doesn’t expose the Entry delegates either :)

I think my Bulk Importer will also have the same ‘bug’. I suppose the question now is do extensions create their own delegates (like I’ve done with the XML Importer), or should they implement the default Symphony one?

Implementing the Symphony one would be the most flexible, but there might be a case (and I haven’t got one in mind FYI) where an extension would like to know if the Entry is being created through /publish or if it’s being imported.

Perhaps a defacto standard could be agreed on so that all ‘Importing’ extensions use the Import prefix to the delegates?

Core team, thoughts?

This brings up something that I’ve mentioned before: should the delegate be on the UI or the object itself? So, should the EntryCreate delegate be fired by the backend page when it creates the entry, or should it be fired by the Entry/EntryManager objects themselves? In most instances it should be the UI, but in this case it makes sense for the object to execute the delegate functions.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details