How to upload into cPanel from a 3rd party URL
Tutorials
Migrating servers is a huge pain in the behind, especially if the file size is huge. The standard method of migrating involves downloading all the old files from one server, then reuploading it into the new server. Not only is this duplicate work and a waste of time, but your internet connection can often be a bottleneck that can extend this task to many hours – assuming nothing goes wrong with your connection.
Here's a much better way to do it, so that your new server pulls the files directly from the old one, bypassing your PC altogether. This is a classic cPanel-era trick, but the upload.php approach works on any host that runs PHP.
- Zip the folder on your old server into a single file.
- Create a new file on your new server called
upload.php, and place it in thepublic_htmlfolder (or any other accessible folder). - Copy the code from this StackOverflow answer, paste it into upload.php, and save.
- Access the file from your browser, e.g.
yourdomain.com/upload.php. - Paste the link to the zipped file from step one, e.g.
olddomain.com/backup.zip. - Wait for it. You'll get a timeout eventually, don't worry about it. Check your cPanel File Manager periodically to see if it's done.
- Extract the zip file. If it extracts cleanly, you're done. Delete upload.php, or move it outside public_html so it isn't abused by bots.
- If the file is large and gets truncated by the timeout (a broken zip extraction), increase
max_execution_timein your PHP Selector.
Credit: Eyal Azulay on StackOverflow