If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

How to organize file download

Started by viprabusiness, Feb 13, 2023, 01:40 AM

Previous topic - Next topic

viprabusinessTopic starter

Hi there.

The website operates on a single hosting platform, which also houses the database. The admin panel, however, is hosted elsewhere.

Thankfully, there are no issues with saving data to the database. The challenge is how to transfer a file from the admin panel's hosting to the hosting where the website resides. Can you provide more details on the type and size of the file being uploaded? This information will help me suggest appropriate transfer methods.
  •  

sanjaysing

There are times when you may need to transfer files directly to another domain without having to go through intermediate web servers. One way to do this is by using download via JS. This can even be done by creating a form.

If you prefer to use JS, you can utilize Plupload. To make sure that POST works on another domain, set the "Access-Control-Allow-Origin" header in upload.php using CORS. You may add a header to your main domain's existing code to achieve this.
  •  

manas

Let me suggest several transfer methods: FTP, NFS or via HTTP request. With HTTP request, you can upload a file to the admin panel, and create another request in the admin panel code using either file_get_contents and stream_context or curl. This will enable you to upload the file to another machine with the website, accept it on the site, and save it where necessary.

If I were to choose between FTP and HTTP, I would prefer either one of those. Nonetheless, the best approach depends on the specific requirements of your use case, such as the size of the files that you need to transfer.
  •  

kevin66

One common approach is to use File Transfer Protocol (FTP) to transfer files from one hosting platform to another. FTP allows you to connect to the admin panel's hosting and transfer files securely to the website's hosting platform.

Alternatively, if both hosting platforms support it, you could use Secure Copy (SCP) or Secure File Transfer Protocol (SFTP) for secure file transfers. These protocols provide encryption during the transfer process, ensuring that your files are protected.

The suitability of each method depends on the specific requirements of your situation, such as the size of the file, security needs, and the capabilities of your hosting platforms. It's also worth checking with your hosting provider to see if they offer any specific file transfer solutions or recommendations.

details you can consider to help narrow down the appropriate transfer method:

1. File Type: Is the file you are trying to transfer a specific type such as an image, document, audio file, or video? Different file types may have different considerations, such as compression, encryption, or specific transfer protocols that might be more suitable.

2. File Size: How large is the file you want to transfer? If it is a small file, you may have more flexibility in choosing a transfer method. On the other hand, transferring large files may require consideration of bandwidth limitations and transfer speeds.

3. Security Requirements: Are there any specific security requirements for the transfer? If you need to ensure the file's integrity and prevent unauthorized access, you may want to prioritize secure file transfer methods such as SFTP or SCP.

4. Connectivity and Access: What kind of network connectivity do the hosting platforms have? Are there any firewalls or network restrictions in place that could limit certain transfer methods? You may need to check with your hosting provider to ensure they support the transfer method you choose.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...