我有一個PHP web應用程序,允許用戶將圖像上傳到我的網站。我正在使用一個簡單的HTML <form enctype="multipart/form-data">
Web開發:如何讓用戶直接將文件上傳到我的CDN(Cachefly)?
但是,而不是將這些圖像上傳到我的網絡服務器 - 我會把這些圖像直接上傳到我的CDN(Cachefly - 這是另一臺服務器)。
這是可能的...有一個網絡應用程序允許用戶直接上傳圖像到另一臺服務器?
萬一有幫助,這是我的PHP代碼:
$target_path = "/home/www/example.com/uploads/";
$target_path = $target_path . basename($_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
// file has been uploaded **LOCALLY**
// HOWEVER, instead of it being upload locally, I would like the file
// to be directly uploaded to the CDN ('other' server)
...
} else{
// error: file did not get uploaded correctly
....
}
我已將原代碼中的代碼包含在 – Tim 2009-10-15 19:23:02