3
A
回答
4
嘗試使用https://github.com/lovattj/php-skydrive
上傳例如:
<?php
require_once 'functions.inc.php';
$token = skydrive_tokenstore::acquire_token(); // Call this function to grab a current access_token, or false if none is available.
if (!$token) { // If no token, prompt to login. Call skydrive_auth::build_oauth_url() to get the redirect URL.
echo "<div>";
echo "<img src='statics/key-icon.png'> ";
echo "<a href='" . skydrive_auth::build_oauth_url() . "'>Login with SkyDrive</a></span>";
echo "</div>";
} else {
$sd = new skydrive($token);
try {
$response = $sd->put_file($_GET['folderid'], '/file/to/put');
// File was uploaded, return metadata.
print_r($response);
} catch (Exception $e) {
// An error occured, print HTTP status code and description.
echo "Error: ".$e->getMessage();
exit;
}
}
0
參考:http://www.onlinecode.org/onedrive-file-upload-using-php/ 代碼onedrive上傳文件REST API
$real_uploadfile = $_FILES["uploadfile"]["name"];
$temp = explode(".", $_FILES["uploadfile"]["name"]);
$temp_ral = $temp[0];
$newfilename = date("Ymd").round(microtime(true)) .$temp_ral. '.' . end($temp).$file_name;
$file_tmp = $_FILES['uploadfile']['tmp_name'];
// check folder is exist in over system
if (!file_exists('uploads')) {
// create new folder
mkdir('uploads', 0777, true);
}
$target_dir = "uploads/";
$uplode_path = $target_dir.$newfilename;
move_uploaded_file($file_tmp,$uplode_path);
$skydrive = new skydrive($token);
// onedrive upload file using php
$folderid = $_POST['folderid'];
try {
$response_data = $skydrive->put_file($_GET['folderid'], $uplode_path);
// File was uploaded, return metadata.
print_r($response_data);
}
catch (Exception $exception)
{
// An error accrue for onedrive file upload using php
echo "Error: ".$exception->getMessage();
exit;
}
相關問題
- 1. 通過BITS上傳到OneDrive
- 2. 使用JQuery通過AJAX從OneDrive上傳文件時出錯
- 3. PHP Image上傳通過JQUERY
- 4. 通過PHP上傳文件
- 5. OneDrive的塊上傳(可恢復上傳)?
- 6. OneDrive SDK上傳文件夾
- 7. OneDrive Android SDK上傳錯誤
- 8. 通過上傳
- 9. 通過php在java中上傳文件
- 10. 我無法通過php上傳文件
- 11. 使用PHP通過FTP上傳文件
- 12. php通過ftp大量上傳
- 13. 通過PHP將文件上傳到mediawiki
- 14. 使用PHP通過ajax上傳文件
- 15. 通過ajax上傳文件jquery php api
- 16. 通過PHP無法上傳.xml文件
- 17. 通過Jquery Form和PHP上傳圖片
- 18. 通過FileAPI和PHP上傳圖像
- 19. 通過FTP在php上傳文件
- 20. 通過php上傳MP3文件
- 21. Android - 通過PHP腳本上傳圖片
- 22. 通過ajax將文件上傳到php
- 23. 通過PHP上傳FTP表格
- 24. FTP通過PHP上傳和下載
- 25. 通過php上傳文件時出錯
- 26. 通過PHP/MySQL上傳圖片
- 27. 通過PHP上傳的歌曲
- 28. 文件沒有通過PHP上傳
- 29. 通過PHP FTP上傳整個目錄
- 30. 通過php上傳權限問題
感謝分配 工作 –