As many of you already know, & rest will be known by the end of the post that you can make FTP connections and actions by PHP, we can create a simple one-page FTP based File Uploader running in PHP 🙂
Well, are you wondering, what’s the need of this heck when we can already upload files by simple PHP calls? Well, many of us run our files on Free Hosting Providers, and they dont allow us to write files. They simply restrict opening files in Write mode, so though we can read the file from a remote location, we can’t write it safely in our server 😦
So if we want to copy some files from another server to our server, & if you’re allowed to make FTP connections (that means you have an FTP username & password) we can use the script below. This is a one file PHP script, Put it in the directory where you want to upload files, and use it with simple efforts.
The code is pretty self-explanatory, so if you’re going to modify it, you’ll find it a piece of cake!
Really simple huh?
- If FTP is not enabled in your server configuration, this will not work. Check your PHP configuration by phpinfo();
- If your server configuration restricts remote opening file (reading files hosted in other server) , this will not work.