title: How to upload file on another domain?
body: <p>I have an external hosting server.</p>
  
  <p>On that server I have 2 domains: </p>
  
  <ul>
  <li><code>www.dom1.com</code></li>
  <li><code>www.dom2.com</code></li>
  </ul>
  
  <p>On <code>www.dom1.com</code> I have my whole web page (in Codeigniter). One of the functionalities is upload (users can upload their files.)</p>
  
  <p>On <code>www.dom2.com</code> there is only one folder called upload_dom2. <code>www.dom2.com</code> is otherwise empty and not visible anywhere on the Internet. I would like to use it exclusively for upload. I imagine that this is a much safer way than letting the users upload their files on <code>www.dom1.com</code> where all my other files are (by the way, let me know if I'm wrong, please).</p>
  
  <p>So, how do I do that? How do I upload a file - that user has uploaded in the framework of Codeignitors system (webpage) on <code>www.dom1.com</code> - in a folder called upload-dom2 on <code>www.dom2.com</code></p>
  
  <p>I know how to upload a file in a folder called uplod_dom1 that is located on <code>www.dom1.com</code>. This is a code that I use.</p>
  
  <pre><code>$pathd=$_SERVER['DOCUMENT_ROOT'];
  $config['upload_path'] = $pathd.'/upload_dom1';
  </code></pre>
  
  <p>But as said, that is not what I want. I want to upload to <code>www.dom2.com</code> (in its uplod-dom2 folder).</p>
  
  <p>May I know what is the correct way to achieve my objective?</p>