SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    PHP/Rails Developer Czaries's Avatar
    Join Date
    May 2004
    Location
    Central USA
    Posts
    806
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    File Upload with Multiple Adapters

    I am currently in the middle of writing a CMS for a client, and have come across the need for a file upload solution. I could do the standard hackey $_FILES handling and file writing to a directory, etc. but the process of thinking about it has left me wondering if there is an existing solution that can do more. I checked out Zend_File and it left me a little disappointed.

    It's okay to write the files to disk at first, but when you scale out you need to put the files elsewhere - Amazon S3, a CDN, separate networked servers, etc. Is there any existing solution that can handle file uploads through the same interface and is able to support multiple backends (I realize this might mean having to store the uploaded file in a local "/tmp" directory first as an intermediate step)?

  2. #2
    SitePoint Wizard Ren's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    1,060
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haven't come across any existing solutions that I liked.

    What I like doing is getting a hash of the contents (eg sha1) and store that in the database.
    All the backend component implementations deal with the sha1 key.

    So a file contents with sha1 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12

    So the basic directory implementation would map it to /somedir/2f/d4/2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 for example.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •