Drupal Camp Slides

Submitted by matthew on September 23, 2009 - 8:21pm

Here are my slides from my Drupal Camp Atlanta presentation. I got caught up with work leading up to the day so most of the content came from Chris Charlton who had put on a previous session a few years ago. Well here they are:

Understanding Drupal

Submitted by matthew on September 21, 2009 - 10:48am

I have been looking for a way to upload a file in flex and save the bytearray directly to drupal via amf. This was written on Drupal 5 however it can easily be added to Drupal 6. Just note there is already a file_services module in D6 and not d5. Here's what I have come up with that works great:

In actionscript 3:

// Use file referance to select a file on the users computer and then load it

public function startUpload():void {
_rf = new FileReference();
_rf = listFiles.selectedItem.file;
_rf.addEventListener(Event.COMPLETE, onLoadComplete);
// On load you can grab the binary data / bytearray from the FileReference.data property
// Make sure you compress the data before you send it.
// Then we call the file.save method with the bytearray and the name of the file

public function onLoadComplete(event:Event):void {
var ba:ByteArray = _rf.data;

// Once the file is saved we get returned the file name!
public function onFileSave(event:ResultEvent):void {
var filename:String = event.result;


* Implementation of hook_service()
function file_service_service() {
return array(
'#method' => 'file.save',
'#callback' => 'file_service_save',
'#access callback' => 'file_service_save_access',
'#args' => array(
'#name' => 'data',
'#type' => 'struct',
'#description' => t('Save bytearray data to a file'),
'#return' => 'string',
'#help' => t('Returns the filename saved.')

// This is all pulled from the drupal file_save_data() function with one minor change
function file_service_save($bytearray, $dest, $replace = FILE_EXISTS_RENAME) {
$file = tempnam(realpath(file_directory_temp()), 'file');

if (!$fp = fopen($file, 'wb')) {
drupal_set_message(t('The file could not be created.'), 'error');
return 0;
// Here is the magic, we just need to add gzuncompress to the bytearray data
$data = gzuncompress($bytearray->data);
fwrite($fp, $data);

if (!file_move($file, $dest, $replace)) {
return 0;

return $file;

function file_service_save_access() {
return TRUE;

Hope this is quite useful for you guys. Note that this will allow any binary file to be saved to the server so you should have some safety precautions to filter harmful extensions and rename them.

Server Move

Submitted by matthew on April 24, 2009 - 10:25am

MrConnerton.com is back up after a move to a new server. Along with the updated servers, the site will be getting some updates.

Flex Interactive Calendar

Submitted by matthew on December 6, 2008 - 12:54am

At work I was asked start development on a new flex calender application that will live on a central server. I am making it as a web app, air app, facebook app, and possibly a mobile phone app, but I am unsure how flex applications will perform on mobile devices.

In the past I have used Quietly Scheming's Flex Interactive Calendar Component. It's initial application was to be used with google calendars or anything in the hcal/ical format. The great thing about expanding this application is that once you see how the calendar handles the data, its quite easy to write your own method for creating CalendarEvent and populating the calendar.

The comments on his webpage ended about a year ago, and I don't believe he has updated the code in quite a bit. Regardless, when you google "flex calendar", this application is generally number 1 or close to it.

Well done indeed.

What is Drupal?

Drupal - a completely free, open source content management system that many organizations are using today to provide for their needs. Drupal's many features and add-ons allow it to be used for a variety of website needs. Drupal is a good choice for today's organizations of any size because it is free, easy, and incredibly flexible.

Copyright © mrconnerton.com, 2008-2010. All Rights Reserved Drupal theme by Kiwi Themes.