Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Bulk Uploader Module: Testers needed!


Go to End


57 Posts   19192 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

13 January 2009 at 5:48pm

Keep in mind a normal FileField limits you to uploading to just /assets/Uploads.

For all intents and purposes, you can ignore the file_destination_path config var in SWFUpload. It's legacy and never used anymore. When SWFupload has a successful push to the server, it runs the handleswfupload() function on the current controller. You're welcome to do whatever you want in that function using the array of uploaded File ID's, $_POST['uploaded_files'].

Looks like the version of BulkUploader that I checked in had some test code that I was playing around with. Remove this from bulk_uploader/_config.php

SortableDataObject::add_sortable_class('GalleryPhoto');

I'm working on the documentation for SWFUploadField as of now. The whole idea of that module is that it can be customized to do what you need it to. In the docs I'll include an example of how to add a folder choice to your SWFUploadField. It's super easy.

Avatar
Amir Mostofi

Community Member, 59 Posts

13 January 2009 at 6:01pm

Edited: 13/01/2009 6:05pm

I removed

SortableDataObject::add_sortable_class('GalleryPhoto');

from bulk_uploader/_config.php, did a dev/build and now I get the following error:

-----------------
[Warning] Cannot modify header information - headers already sent by (output started at /Users/Amir/Sites/silverstripe/mysite/code/Resource.php:26)
GET /silverstripe/dev/build

Line 60 in /Users/Amir/Sites/silverstripe/sapphire/main.php

Source

51 * @see Director::direct()
52 */
53
54
55 /**
56 * Include Sapphire's core code
57 */
58 require_once("core/Core.php");
59
60 header("Content-type: text/html; charset=\"utf-8\"");
61 if (function_exists('mb_http_output')) {
62 mb_http_output('UTF-8');
63 mb_internal_encoding('UTF-8');
64 }
65
66 Session::start();
Trace

header(Content-type: text/html; charset="utf-8")
Line 60 of main.php
-----------------

It's definitely related to the latest SVN version of sortable_dataobject, since when I go back to an earlier version, dev/build does not throw an error.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

14 January 2009 at 4:24pm

Somehow you've got output happening on line 26 of your Resource.php file. Let me know what's going on there. Probably white space?

Avatar
Amir Mostofi

Community Member, 59 Posts

14 January 2009 at 4:48pm

Edited: 14/01/2009 4:50pm

As you suspected!. It was an empty line after ?>. (But, it worked fine with an earlier version of sortable_dataobject!)
It all works and the sortable_dataobject resorting now works out of the box without the need for any user custom functions.

Thanks.

What's the deal with the php code being so sensitive to empty spaces?

BTW, how are you progressing with the SWFUploadField documentation?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

14 January 2009 at 5:25pm

It's got nothing to do with PHP. It's an HTTP thing. Think about it. PHP tries to send header information about the document, but output has already been sent by your PHP script. A space, though invisible to you, is read by the browser. That's why you can see all the spaces between these words. To a browser, it might as well be the letter A or a series of ampersands.

Now the browser needs to make assumptions about what kind of content it's rendering, so it builds out HTTP headers to accommodate the space. Silverstripe somewhere along the line builds its own header information -- for caching, sessions, redirects, whatever, and it can't because the headers are already built.

Seems annoying, but if you think about it, it would be surprising if it didn't happen.

Best advice i have for you is NEVER close a php tag in your controllers or models. That way, the entire file is parsed as PHP and none of the spaces will render in the browser.

SWFUpload docs are coming along. Most of my time tonight went into getting the EventCalendar preview out the door.

Avatar
Amir Mostofi

Community Member, 59 Posts

21 January 2009 at 12:44pm

UncleCheese,

I downloaded bulkuploader0.1.4 from http://www.carlinowebdesign.com/bulk-uploader-field/, installed it as before. However, when I try to delete a page in the CMS, the CMS hangs and the following alert error message appears. (The same thing also happens with an earlier version of bulkuploader.)

-----------------
ERROR [Warning]: Bad class value NULL passed to ClassInfo::ancestry()
IN POST /silverstripe/admin/getitem?ID=3&ajax=1
Line 124 in /Users/Amir/Sites/silverstripe/sapphire/core/ClassInfo.php

Source
======
115: }
116:
117: /**
118: * @todo Improve documentation
119: */
120: static function ancestry($class, $onlyWithTables = false) {
121: global $_ALL_CLASSES;
122:
123: if(is_object($class)) $class = $class->class;
* 124: else if(!is_string($class)) user_error("Bad class value " . var_export($class, true) . " passed to
ClassInfo::ancestry()", E_USER_WARNING);
125:
126: $items = $_ALL_CLASSES['parents'][$class];
127: $items[$class] = $class;
128: if($onlyWithTables) foreach($items as $item) {
129: if(!DataObject::has_own_table($item)) unset($items[$item]);
130: }

<br />
<b>Catchable fatal error</b>: Method BulkUploaderField::__toString() must return a string value in <b>/Users/Amir/Sites/silverstripe/sapphire/dev/Debug.php</b> on line <b>558</b><br />
-----------------

Any idea?

Also, when I install bulkuploader0.1.4 (or your latest SVN files), I see both an Upload and an Import button on the left. Import is handled on the right.
Also, when I import a file from the right, it appears on the left. However, edit link does not appear below the file/image. If I click the file/image, I do not get the edit form on the right as before. Furthermore, if I have multiple files attached on the left, I no longer get the previous/next links on the right (I guess this is related to the editing which does not work!).

Can you please help as I wanted to implement bulkuploader for an actual site today, but as such cannot proceed?

Avatar
Amir Mostofi

Community Member, 59 Posts

21 January 2009 at 12:53pm

After installing the latest SVN from "svn co http://svn.codespaces.com/carlinowebdesign/bulk_uploader", when you try to import a file from the right, it says "There are 1 files attached to this page.", but no file actually appears on the left!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

22 January 2009 at 3:32am

Hi, Amir,

I'm sorry you're still having problems. Could you post your code for that page? Use the ZIP file of my website in lieu of the SVN checkout. I'm not too sure that's in a stable state right now.

All of my resources right now are dedicated to getting the Event Calendar module out, so you may have to push back your deadline to this weekend.