Shaun Mccran

My digital playground

15
J
U
L
2011

How best to approach introducing new development standards into a team

One of the issues I've been faced with is applying a hard and fast set of standards to a team of developers, whilst maintaining a balance of getting work out the door.

I can't just wade into the team with new process and Quality Assurance routines and not expect there to be a few bumps in the road.

[ More ]

11
M
A
Y
2011

Handling CFfile upload 'accept' file type errors

I was working on a system recently that allowed a user to upload images onto the server. It was restricted to files types of images, more specifically 'jpeg' and 'gif' files.

This is easily done with the 'accept' parameter, as documented in the ColdFusion documentation:

view plain print about
1Accept:
2
3Limits the MIME types to accept. Comma-delimited list. For example, the following code permits JPEG and Microsoft Word file uploads:
4accept = "image/jpg, application/msword"
5
6The browser uses the file extension to determine file type.

It is important to note here that it is the browser uses the file extension, so renaming an exe to jpg would fool it entirely.

Issues arise when you don't handle an invalid file upload in a friendly manner. In this case when a user tried to upload an incorrect file type they saw a nasty unformatted error message stating that the request could not be processed as the file was the wrong Mime type.

You cannot tell what the file type is until you attempt to upload it, so wrap your cffile tags in a simple try-catch and handle any errors in the same fashion as you normally would, I.E. by handling the system message and instead displaying a nice, user friendly message that doesn't sound like it was written by robots.

view plain print about
1<cftry>
2
3<cffile action="upload" destination="#request.uploadPath#" fileField="form.new_image" accept="image/jpeg, image/gif" nameConflict="overwrite">
4
5<cfcatch>
6
7    <cfset attributes.errors.type = 'error'>
8    <cfset attributes.errors.message = "The type of file you have tried to upload is not allowed, please select a jpg or gif.">
9    <cfset request.continue = false>
10
11</cfcatch>
12
13</cftry>

09
F
E
B
2011

Web Accessibility 101 - What is it, and why do it?

In my developer life I've encountered many different clients who have a multitude of requirements for their web projects. One that is occuring more frequently is 'Accessibility'. Over the past year or so I've had to really delve into what this means for a website, and how it affects IT projects.

This is the first of a series of articles relating to Web Accessibility, breaking down how I understand each aspect of it, including things like best practice coding, testing, what your mark-up really tells impaired users and the general theory behind creating Accessible content. I'll also try and point out any tips I've uncovered to try and smooth out the, sometimes rock, path to validating a site as Accessibly compliant.

[ More ]

23
J
A
N
2011

The Coldfusion Hash() function decoded - kind of

I've always believed that using the hash() function in ColdFusion is a one way process. If I wanted to reverse a string I had to use encode() and decode(). The Adobe documentation states that "It is not possible to convert the hash result back to the source string" - Adobe Docs for Hash().

Strictly speaking this is still true, but some bright spark has decided to host an MD5 string database and provide a lookup service.

[ More ]

_UNKNOWNTRANSLATION_ /