跳到主要內容

[Dropbox] Dropbox API :chooser

Dropbox 提供了簡單的api 讓使用者可以以api的方式取得檔案的資料
如此一來 可以把自己的檔案圖片直接放在dropbox的空間上面
不用在存自己的系統中
當然這是最簡單的用法 有什麼運用就看每個人的自己的開發了

現在要介紹了是 dropbox提供的一個chooser的功能

可以讓你輕易的在你自己的網站上 選取自己在dropbox上的檔案
並取得檔案的路徑資料

1.建立一個Chooser
在網頁https://www.dropbox.com/developers/chooser 中有個[Setup ]-->[Create a new app]

會出現下面這個畫面

填好資料按下[Create]就會建立相關的chooser 並產生 html code

2.把這個code複製到你要放置的網站程式裡,這樣你的系統就接上了 dropbox api

3.另外在<form>中 再加上dropbox-choose的 input

<input type="dropbox-chooser" name="selected-file" style="visibility: hidden;" data-link-type="direct"/>

就完成了

input的參數說明
type: dropbox-chooser
style: visibility: hidden; 一開始要將input設成hidde 等chooser loading完成 他自動會變成visiable
name:回傳的參數名稱
data-link-type:有direct跟preview兩種模式
preview:預設值 不能直接讀取link
direct:可以直接讀取的link ,如果想讓圖片link可以直接在頁面呈現,則需要用這個方式

範例
<script type="text/javascript" src="https://www.dropbox.com/static/api/1/dropbox.js" id="dropboxjs" data-app-key="appkeyh"></script>
<form action="td.asp" method="get">
<input type="dropbox-chooser" name="selected-file" style="visibility: hidden;" data-link-type="direct"/>
<input name="" type="submit" />
</form>

留言

這個網誌中的熱門文章

[WEB]連線 HTTPS 網站發生驗證失敗導致基礎連接已關閉

某支透過 WebClient 物件去呼叫第三方API的程式,突然有天無法使用 經過測試出現下列的錯誤 基礎連接已關閉: 傳送時發生未預期的錯誤。 InnerException : 驗證失敗,因為遠端群體已經關閉傳輸資料流。 原來是第三方的服務已經不支援 TLS 1.0 我方的程式是用.net Framework 4.0開發了 得強制讓webclient改用 TLS 1.1 或 TLS 1.2 感謝黑大提供解決方法 在程式中加入 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12  的設定就解決了這個問題 WebClient wc = new WebClient(); ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; 參考資料:暗黑執行緒

[SQL] SQL依照你的排序條件 找出目前資料的前一筆與下一筆。 Find Pre and Next DataRows of current Datarow by your order condition

有時候需要用SQL找出前一筆跟後一筆資料 用SQL的TOP是沒有辦法做到 這個時候就可以這個語法 select * from ( SELECT TOP 1 * FROM [Article] where Poid {CurrentPoid} order by CreateDate ASC) t2 找出目前PK id前一個與後一個的資料(依照想要排序順序) 那如果指示想要一個資料行呈現的話 可以改用下面的SQL語法 讓這兩筆資料join在同一筆 select Pre.*,Nex.* from (SELECT TOP 1 * ,1 tID FROM [dbo].[Article] where Poid {CurrentPoid} order by CreateDate ASC) Nex on Pre.tID=Nex.tID

Win10電腦 強制開啟IE瀏覽器 by VB script

 用Notapad寫下以下的內容 With CreateObject("InternetExplorer.Application") .visible = True .Navigate [Url]           .Left = 0           .Top = 0           .Height = 1024           .Width = 1280 End With 然後存檔成 .vbs 檔案 之後點選檔案就會自動啟動IE 目前測試過在WIN10 版本能正常執行