Posted Monday December 29, 2014

Writing a re-usable file upload class in PHP

At work, the advertising department sometimes uses what they call “splash pages” when an advertiser wants to advertise on the website but doesn’t have a website of their own to link to. A splash page is just a simple web page with a single image on it. It’s usually a copy of the print ad.

So when they needed a splash page, they would send me the jpeg, I would create a quick and simple web page with it, upload the .html file and the jpeg into a folder on the webserver, then send them the URL for the page.

I wanted to make it possible for them to bypass me completely, so I needed a user-friendly web form that would accept a jpeg file upload, create a web page, and then display the final URL for the user.

I decided that, rather than look for a pre-existing tool to do this, I would take the opportunity to write a secure and robust file upload class that I could use again in future projects.

php secure file uploading class

As a side note, I also used Sublime Text 3 for the project, to give it a good trial run. I like it quite a bit. I have used a bunch of different code editors, from BBEdit, to TextMate, even vi. BBEdit is still the one that does everything well and never fails, but it doesn’t have the nice code-completion features that Sublime has.

using Sublime Text 3 to create a file upload class in PHP

I’ll be sharing my robust PHP file upload class on Github soon, at which point I’ll link to it here.

Posted Friday April 5, 2013

New Mac App: WebCode

Very interesting looking new app from the makers of PaintCode. PaintCode generates Objective C code from the visual elements you draw. WebCode does a similar thing, but for Web technologies instead of Objective C. It looks very cool. I’m downloading the demo to play with it now.

Posted Friday August 3, 2012

Carl Sagan's critique of the 'Contact' movie script

Ever since I read all of Carl Sagan’s non-fiction books, I’ve been confused by the film, ‘Contact’. It’s based on Sagan’s novel, but it always bothered me that the movie didn’t seem to represent his views on religion vs. the scientific worldview.

So it was great to see this post on io9.com showing a letter that Sagan wrote to Warner Brothers expressing his disagreement with the changes they made to his original script. My favorite hand-written note on the letter reads:

“Ellie disgracefully waffles in the face of light-weight theological objections to rationalism — e.g. ‘God is a hell of an engineer.’ Our courageous spokeswoman for the scientific world-view collapses in such exchanges.”

Posted Friday June 29, 2012

iPhone Naysayers

This article on The Loop has a bunch of quotes from pundits who predicted that the iPhone would fail when it was first announced. I especially like this part from Michael Kanellos at CNET:

When the iPod emerged in late 2001, it solved some major problems with MP3 players. Unfortunately for Apple, problems like that don’t exist in the handset business. Cell phones aren’t clunky, inadequate devices. Instead, they are pretty good. Really good.”

I’ve always been totally baffled by iPhone doubters, and by people who thought any smartphone before it was any good at all. I was there at the Steve Jobs keynote when the iPhone was announced, but this has nothing to do with his famous reality distortion field. I like gadgets but there was no smartphone before iPhone that wasn’t terrible. The best ones were just a bit less terrible than the worst ones. In 2006/2007 it was absolutely clear that the iPhone was the first one that was really worth paying attention to, and it has been ever since. I’m telling you, it was dead obvious. The doubters were just that clueless.

« Older

David Schrimpf, Web Developer

David

I have been a full-time professional web developer for over 12 years. This is my blog where I write about topics that interest me, mostly relating to computers and software and the internet.

Check out my portfolio for some examples of my web development & and app development work.

Elsewhere

GitHub