I'm curious how to upload file through FTP using PHP. Let's say I have upload form and user have uploaded a file. How to transfer the file (without moving from temp directory) to some FTP host using PHP?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Here you go:
Error handling omitted for brevity.
Here is a code sample
How about uploading via Curl? (Note: you can also use curl for SFTP, FTPS)
Here's a function to do it for you.
Usage:
FTP password must be in single quote otherwise it will not accept special characters
Have a look at the FTP section on the PHP website - it's very helpful.