views:

39

answers:

2
+1  Q: 

Off-site uploading

I need to somehow integrate off-site uploading onto my website, that is, so the uploading form itself is on my website but the file gets uploaded to a server somewhere else.

I have experience in PHP file uploading and handling, but the files were all being transferred to the machine that held the form. This time I need it to upload directly to a different server.

One way I thought was something like this:

<form action="http://somewhere-else.com/upload.php" enctype="multipart/form-data">
    <input type="file" name="theFile" />
    <input type="submit" value="Upload File" />
</form>

But I'm not sure if that would really work out, would the bandwidth required for uploading the file be used on both the server that handles the page with the form, and the destination upload server? Another way was with iframes, as in have a complete iframe coming from one of the upload servers, but this just seems hacky to me.

Does anyone have any experience in this area that they can use to enlighten me? I would prefer a solution in PHP, if possible.

Cheers.

A: 

On your example the form on the "other" server handles the upload. So any bandiwth and space requirements consideration are for that server. Of course this assumes you have some control over that server.

Sinan
Thanks. So would that be the best way to do it, do you think?
Phox
do you have any control over "other" server?
Sinan
If you can tell us what you need to do so we may come up with a suggestion. You could be thinking upside down.
celalo
Sorry, yes I do have control of the other servers. It's just to distribute the uploads my users do, instead of having it all on beefy main server I want to distribute the load across 2 or 3.
Phox
A: 

It depends on what you're looking to achieve. Is it to save bandwidth on one of your servers? Is it that you simply want uploads stored somewhere else?

Wherever the form address points to, that will take the bandwidth hit for uploading the file.

If you want to keep users on your website throughout the form submission, you can either take the iframe approach, or use PHP socket functions for uploading files via FTP (a quick Google got me this PHP FTP example).

TheDeadMedic