logo

PHP File Uploads

It's been five months since I last wrote an article for the LAMP area of this site. What have you guys been up to since? I know some of you took the bull by the horns and are now well versed in PHP. Were the rest of you waiting for me to get round to the "advanced" section? Well, I'm making a start on that now.

When I say advanced I am merely talking about things we take for granted with Domino. Attachments for example. Stick a File Upload Control on a form and you're done! In PHP it's not quite so easy. I've added a file upload to the PHP journal app.'s form and will start/finish an article some time this week, hopefully.

If you look at the form, notice that I've limited the size of uploads to 10KB. Remember this article I wrote a while back describing a way to do this with Domino? Wasn't easy was it! With PHP it's as simple as one line of code:

if ($HTTP_POST_FILES'attachment' ][ 'size' ] > 10000 ) {

So, whereas, with Domino, it's easy to add the functionality as a whole, it's tricky to do anything beyond the basics. Don't let me get in to a whole "Isn't PHP better than Domino" speel. There's no point in that. It's a case of "horses for courses". Personally I prefer PHP, as you all know, because I can do what I like with it. There might well be some work up front but it's worth it. Plus, once you've coded the logic once you can use it over and over - maybe even writing a class to handle it all.

Comments

    • avatar
    • YoGi
    • Tue 3 Aug 2004 08:42

    you can use $_FILES instead of $HTTP_POST_FILES since php 4.1.0, that's easier (and global arr)

    • avatar
    • Niel Revelle
    • Tue 3 Aug 2004 08:52

    Added a comment to your Domino article on the topic. You can also limit the upload size with one line of @code.

    • avatar
    • Jake
    • Tue 3 Aug 2004 08:57

    Thanks Niel. Added my reply.

    • avatar
    • mt69clp
    • Fri 3 Sep 2004 03:13

    While enjoying your LAMP stuff I am working through a Websphere book. I really like the Websphere Application Developer, it is really a step forward. You can always right-click and everything is done automatically. So you can concentrate on the logic and not on setting dots and braces and so on. Have you tried to code PHP with Eclipse? I think there are some nice plugins to do that.

    • avatar
    • Jake
    • Fri 3 Sep 2004 03:43

    Hadn't tried coding in Eclipse. Will have a go now... well, I got PHPEclipse {Link} up and running ok. Looks good. Shall see if it's any better to coding in Textpad.

  1. sir i want coding for file uploading

    or the proper guidence froom u

    • avatar
    • Patrick
    • Tue 18 Jan 2011 04:38 AM

    Jake,

    I am working out a solution by implementing Uploadify in a Lotus Domino environment. Uploadify also uses PHP with $_FILES instead of $HTTP_POST_FILES. Currently i still cannot figure out how domino could get a handle to a simular to $_FILES.

    The goal of the implementation of Uploadify in my case is to precheck the uploaded Filesize of an attachment before upload to the server.

    Any suggestion is welcome.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Mon 8 Mar 2004

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content