I think the best way is to start with what I am doing. I have a form on my website and they fill it in and upload a picture. The main problem here is that i need to upload a the picture to there website (different domain & server). There is quite a big permisions problem with this.
As a work around what I done was direct the form directly to there domain then put my script that processed it on there server. Thing is im not really that happy with it because any changes means i need to change the file on there server.
Is that any way I can perhaps process it on my server put the image into a session or something that go to there server and upload the image. I dont mind a file on there server but i would like to be able to validate the image (size) and the fields on my server still.
i think any solution is gonna be dirty, but what you could do is trigger a script on the remote server (after the upload is completed), that copies it form your server to that one.
thats not a bad idea. I know its a little dirty and im not really that happy I have to do it like that. Again though, wont I still get a permision problem just the other way round?
nopes. it's just a matter of retrieving an image from a server
if permission problems would be an issue, then your browser would have the same problem.
// Validation via validation page
$error_msg = validate();
if($_SESSION['VAL_TRUE'] == true) {
// Put all the post data into a session //
$_SESSION['POST_DATA'] = validate();
header('Location:' . FILENAME_CHECKOUT_INVOICE . '.php');
} else {
$errors = true;
}
}
The validate functions checks all the post variables and then returns an error msg which i display further on but if its fine and everything has valiadate properly i go to the header location.
How could i put that function into this situation?
the download script can only download remote files to the local server on which the script is running, so what you have to do is put the script on the server where on which you want to download the files. This is in your case the remote server.
Then, when the script is working OK, you access it from your own server using for example fopen.
So,
REMOTE SERVER A:
- /htdocs/download.php
- /htdocs/images/
LOCAL SERVER B:
- htdocs/activate.php
- htdocs/uploaded_files/
download.php contains the script that does the downloading:
Thanks for the break down. I went to the fopen section on php.net before i done posted back up here but cannot seem to see how to retrieve the response?
i think any solution is gonna be dirty, but what you could do is trigger a script on the remote server (after the upload is completed), that copies it form your server to that one.
Ok... but I believe you've got it wrong. The script on the remote server could be as simple as:
No more code than that is required on their server. On your server have a file called yourscript (no extension needed) that contains your PHP script. Now you have complete control of everything directly from a script on your own server.
Bookmarks