SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    May 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How can i redirect a php upload to another server?

    Hello fellow sitepoint users,

    i have an academic project that consists on a simple file hosting service that is currently running on a shared hosting account. i use swfupload and php as my upload method and ATM in storing the files in the shared account.

    Since the TOS of that hosting service forbids the use of shared accounts for that purpose, even only being an academic project, i was thinking on using CloudFiles from Mosso for the storage of the user uploaded files.

    My question is, how can i redirect the upload of the file directly to CloudFiles without any data from the file being sent to the shared account?

    My understanding is that if i use the php method for the upload of the file the file first goes to the shared account's server and only after that is sent to Cloud Files.

    Am i correct? Is there any way to bypass the shared account's server?
    Attached Images Attached Images
    Last edited by NetCrasher; May 3, 2009 at 12:26. Reason: Typo on the title

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you are correct, even if you do a redirect, the file will still be sent to the shared account's server to start with.

    You'd have to set the action on the upload form to a location on the other server if you don't want the file to be uploaded to the shared hosting account. You could then redirect back to a "file uploaded" type page (or similar) on the shared account once the file is uploaded.

    P.S. welcome to SitePoint!

  3. #3
    SitePoint Member
    Join Date
    May 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess im going to have to create a flash component or a java applet to handle the upload and then call some server side script to register the upload to the database.

    Quote Originally Posted by SJH View Post
    P.S. welcome to SitePoint!
    Thank you its the first time i post but i've been lurking for some time

  4. #4
    SitePoint Addict skunkbad's Avatar
    Join Date
    Apr 2008
    Location
    Temecula, CA
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are numerous scripts/classes available via google search that show how to ftp a file upload to another server. The file upload never needs to be stored on the primary server, and most developers would never allow it to be stored there, due to security precautions.

  5. #5
    SitePoint Member
    Join Date
    May 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm sorry, but think you didn't understand my question.

    cloud files api works kinda like the php file methods, open, write, close.

    my problem is that when you upload the file to a server through a form it is handled in php through the $_FILES array, the problem is that if i try to redirect that to cloud files the first data is always sent to my shared account server because my php script is receiving the data from the user and writing the data to cloud files.

    the only way i see to solve that problem is to use client side scripts so that the data is sent directly from the user to cloud files instead of hoping through my server if i use a server-side script.

    ftp isn't possible because cloudfiles doesn't accept ftp connections, either way if i'd use an ftp connection, that connection would be made by my server and not by my user if i use a server side script


Tags for this Thread

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
  •