Search

A new extension, “Bulk Importer” 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.

Some may remember this extension from 2009, it’s back and it’s a wee bit more flexible.

Bulk Importer

The Bulk Importer allows you to upload a zip archive of files to Symphony. The extracted files are injected into a chosen section into an upload field. The name of the file is added to the first instance of a “text input” style field. Optionally, you can link the newly imported entries to another entry using either the Select Box Link, Reference Link or Subsection Manager extensions.

INSTALLATION

  1. Upload the ‘bulkimporter’ folder to your Symphony ‘extensions’ folder.
  2. Enable it by selecting the “Bulk Importer”, choose Enable from the with-selected menu, then click Apply.
  3. You can now import files from the System -> Bulk Importer menu

USAGE

  1. Choose a zip file of files that you wish to upload
  2. Select the section you want these files to be uploaded to and then select the upload field that these files should be uploaded to.
  3. Based on the section you have chosen, the Bulk Importer looks for all related sections and asks if you would like to link these entries using one of these section links. Select the section link and then the entry that you would like the imported files to be associated with.

USE CASE

I have an Images section (Name - Textbox, Upload - Upload) and a Gallery section (Name - Textbox, Related Images - Subsection Manager). I choose the Images section and then the Upload field to import the files into. I then choose the Gallery: Related Images section link and the entry named ‘My Test Album’. Clicking the ‘import’ button will upload the zip file, extract the files and then import them to the Images section. It will also associate these entries in the Images section with the ‘My Test Album’ entry in the Gallery section.

Example Usage

SUPPORTED FIELDS

Upload fields

Any extension that matches the /upload/i regex (which is all known to date).

Text Input fields

The textbox field extension and the core text input field are supported.

Section Link fields

The Selectbox Link, Reference Link and Subsection Manager extensions.

Attachments:
Screen shot 2010-11-11 at 4.14.39 PM.png

Fantastic!

Sweet.

Sweet!

I was literally minutes away from writing an extension like this. Except I was looking for import of a folder which I uploaded through FTP before (not zipped). Looking at your code, it seems easy to hook a similar functionality in.

Would you work on this? Otherwise I would try to edit your code to get this working.

@shorebreak, Nick Dunn has created an Upload Select Box that lets you select files from a folder, although this isn’t a mass import style it might help.

I’m fairly certain the BulkImporter will pick up the Upload Select Box, but it’d be a special case to check that if the field type was Upload Select Box and to modify the code around here

Great extension, simpified version of mass upload and works with subsection manager, just what I need.

One request:
- Is it possible to append and not replace the related entries when upload to an entry that already has values for their linked field?

One comment:
- I think this extension use a classes only available in php 5.3 (RecursiveDirectoryIterator), and use a the function in class.file.php (mimecontenttype) that is deprecated, I had some problems to make it works in my server.

Thanks for this extension.

It seems the zip doesn’t get extracted. It is moved to the target path but that’s it. Also after hitting import all I get is an empty page. Issue

Updated the PHP version and zip extraction is working now (PHP 5.3.2). But still I wasn’t successful importing a zip of jpegs into the dummy symphony setup.

all I get is an empty page

Have you enabled the display of PHP errors? In your .htaccess file add

php_flag display_errors on

And it should give you the actual error rather than a blank page.

@nick THANKS!

So I get this error:

Fatal error: Call to a member function get() on a non-object in /..../bulkimporter/extension.driver.php on line 254

Code Line 254

$fields seems to be an Array not an Object?!

Bulk Importer updated to version 0.9.1 on 15th of November 2010

Fixes

  • Allows you to upload images to a section that has no name field
  • When associating to a linked entry, it will now append instead of erasing all currently linked values
  • Better error checking

It tells me my uploads fail. 15th Nov, 2010 at 06:19pm :: Datei :: 0 uploaded :: 2 failed

Although the files get extracted and moved but the DB is not altered it seems. I’m doing this on the default Symphony 2.1.2.

This is with your 0.9.1 build.

Does it have any dependencies that I am missing?

No dependancies, see the Supported Fields section.

Can you post the details of the section you are trying to import into and some details of the files?

Here is what I did: a fresh symphony installation. latest bulk importer.

create a section: alt text

Goto Bulkimporter and upload this zip file: alt text

Which gives me this: alt text

The ZIP will get extracted and the files are moved: alt text

But not all of them are added: alt text

Before I always got this: alt text Files were extracted but not inserted into the db.

This is written in the main log file in the manifest part of the symphony installation (4 times for the amount of files in the zip):

2010/11/17 16:16:38 > WARNING: 2 - mkdir() [<a href='function.mkdir'>function.mkdir</a>]: File exists in file /Sites/test/symphony/lib/toolkit/class.general.php on line 392

Thanks for this @shorebreak. I’ll take a look today on my lunch break (~4hours away)

I was able to reproduce this and the internal error from the field was:

  • A file with the name adaptor_small.png already exists in /workspace/uploads. Please rename the file first, or choose another.
  • A file with the name arrow_down.png already exists in /workspace/uploads. Please rename the file first, or choose another.
  • A file with the name arrow_right.png already exists in /workspace/uploads. Please rename the file first, or choose another.
  • A file with the name download_small.png already exists in /workspace/uploads. Please rename the file first, or choose another.
  • A file with the name information.png already exists in /workspace/uploads. Please rename the file first, or choose another.

I will be looking at updating the extension to make these errors visible to the user.

Cool! Error output would help for sure. Are these logged somewhere so I can have a look at them? I just have the feeling that it occurs even if the file does not exist already. It’s a little mysterious to me. :)

Thanks for your help!

No these currently aren’t logged anywhere. If your happy to get your hands dirty you can do this:

extension.driver.php

  • Line 220 add $upload_errors = array();
  • Line 295-6 change to:

    if(__ENTRY_FIELD_ERROR__ == $entry->checkPostData($_data,$errors)) { $upload_errors[] = $errors[key($errors)]; continue; }

Then before the // Set the Section Association add: if(!empty($upload_errors)) { return $upload_errors; }

It’s not elegant, but it’ll give you the errors.

received this when uploading a zip:

Fatal error: Undefined class constant 'SKIP_DOTS' in /home/laurawei/public_html/extensions/bulkimporter/extension.driver.php on line 103

what other information do you need for this? should i add an issue to the tracker?

What version of PHP are you running? I believe I’ve used a function in here that’s only in PHP5.3

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