Archive for October, 2009

9Oct Flash ActionScript 3.0 – Uploading an image

I’ve been having trouble implementing the code to upload an image to a server. The code is basically this:

Set the variables for the file reference, file types to filter by and the url to send the image to:

var imagesFilter:FileFilter = new FileFilter("Images", "*.jpg;*.gif;*.png");
var fileReference:FileReference = new FileReference();
var uploadURL:URLRequest;
uploadURL = new URLRequest ("upload.php");

Select which file you want to upload to the server.

fileReference.addEventListener(Event.SELECT, selectHandler);
fileReference.browse([imagesFilter]);

Function to tell Flash what to do once you have selected your file.

function selectHandler (event:Event):void {
var file:FileReference = FileReference(event.target);
file.upload(uploadURL);
}

Then use the following PHP code in a file called upload.php.

<?PHP
// The folder where the image will be uploaded to
$target_path = "uploads/";
/* Then add the original filename to the target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['Filedata']['name']);
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $target_path)) {
echo "The file ".  basename( $_FILES['Filedata']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>

So, why wasn’t is working

So basically, this code wasn’t working, and I had no idea why. I kept getting the generic error [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2038"].

A nice relaxing sleep later I did some more searching and discovered this wonderful post: Romantika.name | Flash Uploader Error. Which basically informed me that there can be a security issue with Flash trying to upload things to a server. I updated my .htaccess file and ta da….all worked perfectly.

5Oct She’s got the look?

When I started out as a designer I found the idea of creating a brand identity to be a mystical and exciting thing. Putting shapes and words together to create something with it’s own personality, to encompass what a company was about, was quite appealing, but as I developed my skills in both print and web design I discovered that it was something I tended to struggle with, and then just neglect. Then, as I found my interests lay more towards web design, with it’s wonderful mix of problem solving, creative design and programming, I just never quite got around to getting any better at it.

So, around ten years later the idea of creating a brand for myself didn’t even cross my mind. When creating this site, I just naturally created a little ident that I was rather fond of, instead of spending hours thinking of what I wanted my logo to say to other people. Hence, I was rather surprised, and flattered, when David Pache contacted me to ask if he could include my website brand in part 3 of his 100 Brands of Interest.

This has gotten me thinking about my original love for brand identity and how I’ve never quite felt comfortable around it. I believe the time is now to re-examine it. I’ve enjoyed developing my illustration skills, and thanks to iStock’s new product, Logos : Logos come to istock, I have a great new avenue to help me rediscover my lost interest in logo design.

I’ll let you know how I get on!