Hello,
I programmed a cross-domain file upload, because I want the uploaded files to be in a separate subdomain, which I may move to another sever in the future..
Knowing the cross-domain problem in iframe I'm using the following code:
In the main file I have (hosted no domain):
filebrowserUploadUrl : 'http://files.domain/admin/upload.php?respond_url=<?=urlencode("http://".$_SERVER['HTTP_HOST'].base_path()."func/confirm_upload.php"); ?>', ... function hello(funcNum, url, message) { alert('you called me! great!'); CKEDITOR.tools.callFunction(funcNum, url, message); }
In upload.php (hosted on the files.domain):
echo "<iframe src='" . $response_url . "?CKEditorFuncNum=" . $funcNum . "&message=" . urlencode($message) . "&url=" . urlencode($url) . "'></iframe>";
And finally in confirm_upload.php (hosted on domain):
echo "<script type='text/javascript'>window.parent.parent.hello($funcNum, '$url', '$message')</script>";
My code is working, because:
1. The file has been uploaded on the server,
2. I get the alert message 'you called me! great!'
But I cannot use CKEDITOR.tools.callFunction(numFunc), because the script is stopped by the domain check by the browser (but the function hello() has been called!!!).
It seems the callFunction is using some global window variable, which cannot be loaded, but why?!
Do you have some other trick I can use?
Many Thanks
BrainBurner