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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Preview: DataObjectManager module


Go to End
Reply


379 Posts   62733 Views

Avatar
UncleCheese

Forum Moderator, 4094 Posts

25 April 2009 at 5:55am

I've checked in the getUploadFolder() fix. Thanks for that.

I'm not sure about your second request. Couldn't you just do $manager->setUploadFolder("Uploads/$this->ID")?

Avatar
hu

Community Member, 21 Posts

25 April 2009 at 5:55am

Or with unique name...

$managerImages->setUploadFolder('Uploads/[URLSegment]');


public function __construct($controller, $name, ...)
{
...
   $this->controllerID = $controller->ID;
   $this->controllerURLSegment = $controller->URLSegment;
}

public function getUploadFolder()
{
   $path = $this->uploadFolder;
   $path = str_replace("[ID]", $this->controllerID, $path);
   $path = str_replace("[URLSegment]", $this->controller->URLSegment, $path);
   return $path;
}

Avatar
hu

Community Member, 21 Posts

25 April 2009 at 5:59am

@UncleCheese

you're right. that's what i'm looking for...

$managerImages->setUploadFolder("Uploads/$this->URLSegment");

Thank you...

Avatar
drye

Community Member, 49 Posts

25 April 2009 at 7:33pm

@UncleCheese

What do you think about adding support for a none selection in SimpleTreeDropdownField?

Avatar
Johnny

Community Member, 34 Posts

26 April 2009 at 4:28am

Hi!

There's a bug for the swffileupload.

When :
Director::set_environment_type ('dev');

Then the file upload doesn't work. Maybe SS is adding some tags in Ajax responses that swffileupload doesn't know how to handle...

JP

Avatar
UncleCheese

Forum Moderator, 4094 Posts

26 April 2009 at 1:38pm

Could you please be more descriptive than "doesn't work?" I have all my FileDataObjectManager instances running in dev mode, so if you could provide details on what is failing and when, I can look into the issue.

Avatar
Johnny

Community Member, 34 Posts

26 April 2009 at 1:46pm

When I try to upload a file, an alert (js) says "An error occurred in the upload. Try again later.". Then, another alert says "There was a problem with the upload.
The server did not accept it."

Here's what the debug window says :

---SWFUpload Instance Info---
Version: 2.2.0 Alpha
Movie Name: SWFUpload_0
Settings:
   upload_url: http://localhost:8888/parking/FileDataObjectManager_Controller/handleswfupload
   flash_url: http://localhost:8888/parking/swfupload/javascript/swfupload.swf?swfuploadrnd=98096338
   use_query_string: false
   file_post_name: swfupload_file
   post_params: [object Object]
   file_types:
   file_types_description:
   file_size_limit: 32768
   file_upload_limit: 20
   file_queue_limit: 20
   debug: true
   prevent_swf_caching: true
   button_placeholder_id: spanButtonPlaceholder
   button_image_url: http://localhost:8888/parking/swfupload/images/upload_button.png
   button_width: 180
   button_height: 24
   button_text: <span class='button'>Upload files</span>
   button_text_style: .button { font-family: Helvetica, Arial, sans-serif; font-size: 12px; }
   button_text_top_padding: 6
   button_text_left_padding: 6
   button_action: -110
   button_disabled: false
   custom_settings: [object Object]
Event Handlers:
   swfupload_loaded_handler assigned: true
   file_dialog_start_handler assigned: true
   file_queued_handler assigned: true
   file_queue_error_handler assigned: true
   upload_start_handler assigned: true
   upload_progress_handler assigned: true
   upload_error_handler assigned: true
   upload_success_handler assigned: true
   upload_complete_handler assigned: true
   debug_handler assigned: true

SWF DEBUG: SWFUpload Init Complete
SWF DEBUG:
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number: SWFUPLOAD 2.2.0 Alpha 2008-10-17
SWF DEBUG: movieName: SWFUpload_0
SWF DEBUG: Upload URL: http://localhost:8888/parking/FileDataObjectManager_Controller/handleswfupload
SWF DEBUG: File Types String: *.*
SWF DEBUG: Parsed File Types:
SWF DEBUG: File Types Description: ()
SWF DEBUG: File Size Limit: 33554432 bytes
SWF DEBUG: File Upload Limit: 20
SWF DEBUG: File Queue Limit: 20
SWF DEBUG: Post Params:
SWF DEBUG: dataObjectFieldName=Songs
SWF DEBUG: dataObjectClassName=Song
SWF DEBUG: fileClassName=File
SWF DEBUG: controllerID=1
SWF DEBUG: OverrideUploadFolder=Uploads
SWF DEBUG: fileFieldName=Attachment
SWF DEBUG: parentIDName=
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.*
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.*
SWF DEBUG: Event: fileDialogComplete: File Dialog window cancelled.
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: dataObjectFieldName=Songs
SWF DEBUG: Global Post Item: dataObjectClassName=Song
SWF DEBUG: Global Post Item: fileClassName=File
SWF DEBUG: Global Post Item: controllerID=1
SWF DEBUG: Global Post Item: OverrideUploadFolder=Uploads
SWF DEBUG: Global Post Item: fileFieldName=Attachment
SWF DEBUG: Global Post Item: parentIDName=
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to http://localhost:8888/parking/FileDataObjectManager_Controller/handleswfupload for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 4659200. Total: 4951286
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 4951286. Total: 4951286
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 500.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
Error Code: -200, File name: 01 Charley.m4p, File size: 4951286, Message: 500

It only bugs when the environment is set to dev...

Hope this could help!

Thanks!

JP

Avatar
UncleCheese

Forum Moderator, 4094 Posts

26 April 2009 at 1:51pm

Hi, Johnny,

Here's what you can do. It's tedious, but it will find the error eventually. Unfortunately, Flash can't report back PHP error output, so all it can tell you is that a 500 error level error occurred.

To figure out where the error is, first put this in your _config.php:

SWFUploadConfig::debug();

Then, go to your handleswfupload() function in FileDataObjectManager_Controller (FileDataObjectManager.php) and put various die() statements in different lines of the code. When you run the uploader, the form will not submit, it will just throw a JS alert that says, "Server said xxx", where "xxx" is the output of your die() statement. Eventually you'll figure out which line is throwing the error. Let me know what it is and I can help you from there.

Go to Top