The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Upload.cshtml 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. <bundle src="css/help.min.css" append-version="true"></bundle>
  3. <div class="container">
  4. <ol class="breadcrumb">
  5. <li><a href="@Url.SubRouteUrl("help", "Help.Index")">Help Index</a></li>
  6. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = string.Empty, service = string.Empty })">API</a></li>
  7. <li>v1</li>
  8. <li class="active"><a href="#">Upload Service</a></li>
  9. </ol>
  10. <div class="row api">
  11. <h2><b>Upload Service</b></h2>
  12. <hr>
  13. <p>This is a description of the API commands available for the Upload service.</p>
  14. <h3>Upload a File</h3>
  15. <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
  16. <h4>Parameters</h4>
  17. <table>
  18. <thead>
  19. <tr>
  20. <th>Name</th>
  21. <th>Type</th>
  22. <th>Default</th>
  23. <th>Description</th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. <tr>
  28. <td>
  29. <code>file</code>
  30. </td>
  31. <td>
  32. <code>file</code>
  33. </td>
  34. <td>
  35. <var>NULL</var>
  36. </td>
  37. <td>
  38. <strong>Required</strong>
  39. The file that you would like to upload.
  40. </td>
  41. </tr>
  42. <tr>
  43. <td>
  44. <code>contentType</code>
  45. </td>
  46. <td>
  47. <code>string</code>
  48. </td>
  49. <td>
  50. <var>no</var>
  51. </td>
  52. <td>
  53. The content-type of the file you are uploading. Only required if the file being uploaded is already encrypted.
  54. </td>
  55. </tr>
  56. <tr>
  57. <td>
  58. <code>encrypt</code>
  59. </td>
  60. <td>
  61. <code>bool</code>
  62. </td>
  63. <td>
  64. <var>true</var>
  65. </td>
  66. <td>
  67. If you want the file to be encrypted server side. This will regenerate the key and/or iv if none are passed in.
  68. </td>
  69. </tr>
  70. <tr>
  71. <td>
  72. <code>saveKey</code>
  73. </td>
  74. <td>
  75. <code>bool</code>
  76. </td>
  77. <td>
  78. <var>true</var>
  79. </td>
  80. <td>
  81. Saves the passed in or generated key to the server. This will make it so that on download, the file will decrypt server side.
  82. </td>
  83. </tr>
  84. <tr>
  85. <td>
  86. <code>key</code>
  87. </td>
  88. <td>
  89. <code>string</code>
  90. </td>
  91. <td>
  92. <var>NULL</var>
  93. </td>
  94. <td>
  95. If you want the file to be decrypted server side, include the key.
  96. </td>
  97. </tr>
  98. <tr>
  99. <td>
  100. <code>keySize</code>
  101. </td>
  102. <td>
  103. <code>int</code>
  104. </td>
  105. <td>
  106. <var>@Config.UploadConfig.KeySize</var>
  107. </td>
  108. <td>
  109. The size of the key provided in bits. Only needed if encrypting and no key is provided.
  110. </td>
  111. </tr>
  112. <tr>
  113. <td>
  114. <code>iv</code>
  115. </td>
  116. <td>
  117. <code>string</code>
  118. </td>
  119. <td>
  120. <var>NULL</var>
  121. </td>
  122. <td>
  123. If the file has been encrypted and you want it decrypted (Both Server and Client Side), include the iv.
  124. </td>
  125. </tr>
  126. <tr>
  127. <td>
  128. <code>blockSize</code>
  129. </td>
  130. <td>
  131. <code>int</code>
  132. </td>
  133. <td>
  134. <var>@Config.UploadConfig.BlockSize</var>
  135. </td>
  136. <td>
  137. The size of the iv provided in bits. Only needed if encrypting and no iv is provided.
  138. </td>
  139. </tr>
  140. <tr>
  141. <td>
  142. <code>expireUnit</code>
  143. </td>
  144. <td>
  145. <code>string</code>
  146. </td>
  147. <td>
  148. <var>never</var>
  149. </td>
  150. <td>
  151. The expiration type for the paste. Possible values are <code>view</code> (Max number of Downloads) or a date value <code>minute</code>, <code>hour</code>, <code>day</code>, <code>month</code>, <code>year</code>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td>
  156. <code>expireLength</code>
  157. </td>
  158. <td>
  159. <code>int</code>
  160. </td>
  161. <td>
  162. <var>1</var>
  163. </td>
  164. <td>
  165. The length of whatever unit you choose before the paste is deleted.
  166. </td>
  167. </tr>
  168. <tr>
  169. <td>
  170. <code>genDeletionKey</code>
  171. </td>
  172. <td>
  173. <code>bool</code>
  174. </td>
  175. <td>
  176. <var>false</var>
  177. </td>
  178. <td>
  179. Generates a deletion key.
  180. </td>
  181. </tr>
  182. </tbody>
  183. </table>
  184. <h4>Response</h4>
  185. <pre><code>{"result":{"url":"<var>url</var>", "fileName":"<var>fileName</var>", "contentType":"<var>contentType</var>", "contentLength":<var>contentLength</var>, "key":<var>key</var>, "keySize":<var>keySize</var>, "iv":<var>iv</var>, "blockSize":<var>blockSize</var>, "deletionKey":<var>deletionKey</var>}}</code></pre>
  186. <table>
  187. <thead>
  188. <tr>
  189. <th>Name</th>
  190. <th>Type</th>
  191. <th>Description</th>
  192. </tr>
  193. </thead>
  194. <tbody>
  195. <tr>
  196. <td>
  197. <code>url</code>
  198. </td>
  199. <td>
  200. <code>string</code>
  201. </td>
  202. <td>
  203. The direct url to the uploaded file. The key is apended to the url as an anchor tag.
  204. </td>
  205. </tr>
  206. <tr>
  207. <td>
  208. <code>fileName</code>
  209. </td>
  210. <td>
  211. <code>string</code>
  212. </td>
  213. <td>
  214. The filename of the uploaded file.
  215. </td>
  216. </tr>
  217. <tr>
  218. <td>
  219. <code>contentType</code>
  220. </td>
  221. <td>
  222. <code>string</code>
  223. </td>
  224. <td>
  225. The MIME file type of the uploaded file.
  226. </td>
  227. </tr>
  228. <tr>
  229. <td>
  230. <code>contentLength</code>
  231. </td>
  232. <td>
  233. <code>integer</code>
  234. </td>
  235. <td>
  236. The size of the uploaded file in bytes.
  237. </td>
  238. </tr>
  239. <tr>
  240. <td>
  241. <code>key</code>
  242. </td>
  243. <td>
  244. <code>string</code>
  245. </td>
  246. <td>
  247. <strong>Optional</strong>
  248. The key that was used to encrypt the file.
  249. </td>
  250. </tr>
  251. <tr>
  252. <td>
  253. <code>keySize</code>
  254. </td>
  255. <td>
  256. <code>int</code>
  257. </td>
  258. <td>
  259. The size of the key used in bits.
  260. </td>
  261. </tr>
  262. <tr>
  263. <td>
  264. <code>iv</code>
  265. </td>
  266. <td>
  267. <code>string</code>
  268. </td>
  269. <td>
  270. <strong>Optional</strong>
  271. The iv that was used to encrypt the file.
  272. </td>
  273. </tr>
  274. <tr>
  275. <td>
  276. <code>blockSize</code>
  277. </td>
  278. <td>
  279. <code>int</code>
  280. </td>
  281. <td>
  282. The size of the iv used in bits.
  283. </td>
  284. </tr>
  285. <tr>
  286. <td>
  287. <code>maxDownloads</code>
  288. </td>
  289. <td>
  290. <code>int</code>
  291. </td>
  292. <td>
  293. The maximum number of uploads before the upload is deleted.
  294. </td>
  295. </tr>
  296. <tr>
  297. <td>
  298. <code>expirationDate</code>
  299. </td>
  300. <td>
  301. <code>datetime</code>
  302. </td>
  303. <td>
  304. The date of expiration of the upload.
  305. </td>
  306. </tr>
  307. <tr>
  308. <td>
  309. <code>deletionKey</code>
  310. </td>
  311. <td>
  312. <code>string</code>
  313. </td>
  314. <td>
  315. <strong>Optional</strong>
  316. The deletion key for file. Use it as follows: <code>@Url.SubRouteUrl("u", "Upload.DeleteByKey", new { file = "file.jpg", key = "deletionKey" })</code>
  317. </td>
  318. </tr>
  319. </tbody>
  320. </table>
  321. <h4>Example</h4>
  322. <pre><code>$ curl -F "genDeletionKey=true" -F "encrypt=true" -F "file=@("@")image.png" @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
  323. <p>
  324. This will upload the file <var>image.png</var>, encrypt it, and then generate a deletion key.
  325. </p>
  326. <br />
  327. <br />
  328. </div>
  329. </div>