images, servers and databases

Discussion in 'PHP' started by DrMalloc, Oct 8, 2006.

  1. #1
    I'm currently working on a site where I need users to be able to upload images (with a managed quota). A problem I foresee is that if the usercount goes up and I have to move image hosting to other servers, it'll make storing the location of the images in the database a little more difficult. It might also be a problem if i want to move batches of images to another server, I'd have to update all the database records for existing images. Have any of you had to deal with this problem, and if so, what was your solution?
     
    DrMalloc, Oct 8, 2006 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Same problem occured with me in file hosting.

    What I did was I added a field "server_id" to the table.

    Since all prior files are on first server they get value one.

    New ones get value two

    then to access the images you do: http://srvrX.sitename.com (where x is the server name).

    and on the other server, you need only 2 filse, one to access and display the images and one to upload the image and redirect back to main server with links.

    Peace,
     
    Barti1987, Oct 8, 2006 IP
    DrMalloc likes this.