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 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. @Styles.Render("~/Content/help");
  3. <div class="container">
  4. <div class="row api">
  5. <h2><b>Upload Service</b></h2>
  6. <hr>
  7. <p>This is a description of the API commands available for the Upload service.</p>
  8. <h3>Upload a File</h3>
  9. <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
  10. <h4>Parameters</h4>
  11. <table>
  12. <thead>
  13. <tr>
  14. <th>Name</th>
  15. <th>Type</th>
  16. <th>Default</th>
  17. <th>Description</th>
  18. </tr>
  19. </thead>
  20. <tbody>
  21. <tr>
  22. <td>
  23. <code>file</code>
  24. </td>
  25. <td>
  26. <code>file</code>
  27. </td>
  28. <td>
  29. <var>NULL</var>
  30. </td>
  31. <td>
  32. <strong>Required</strong>
  33. The file that you would like to upload.
  34. </td>
  35. </tr>
  36. <tr>
  37. <td>
  38. <code>contentType</code>
  39. </td>
  40. <td>
  41. <code>string</code>
  42. </td>
  43. <td>
  44. <var>no</var>
  45. </td>
  46. <td>
  47. The content-type of the file you are uploading. Only required if the file being uploaded is already encrypted.
  48. </td>
  49. </tr>
  50. <tr>
  51. <td>
  52. <code>encrypt</code>
  53. </td>
  54. <td>
  55. <code>bool</code>
  56. </td>
  57. <td>
  58. <var>false</var>
  59. </td>
  60. <td>
  61. If you want the file to be encrypted server side. This will regenerate the key and/or iv if none are passed in.
  62. </td>
  63. </tr>
  64. <tr>
  65. <td>
  66. <code>saveKey</code>
  67. </td>
  68. <td>
  69. <code>bool</code>
  70. </td>
  71. <td>
  72. <var>false</var>
  73. </td>
  74. <td>
  75. Saves the passed in or generated key to the server. This will make it so that on download, the file will decrypt server side.
  76. </td>
  77. </tr>
  78. <tr>
  79. <td>
  80. <code>key</code>
  81. </td>
  82. <td>
  83. <code>string</code>
  84. </td>
  85. <td>
  86. <var>NULL</var>
  87. </td>
  88. <td>
  89. If you want the file to be decrypted server side, include the key.
  90. </td>
  91. </tr>
  92. <tr>
  93. <td>
  94. <code>keySize</code>
  95. </td>
  96. <td>
  97. <code>int</code>
  98. </td>
  99. <td>
  100. <var>@Model.Config.UploadConfig.KeySize</var>
  101. </td>
  102. <td>
  103. The size of the key provided in bytes. Only needed if encrypting and no key is provided.
  104. </td>
  105. </tr>
  106. <tr>
  107. <td>
  108. <code>iv</code>
  109. </td>
  110. <td>
  111. <code>string</code>
  112. </td>
  113. <td>
  114. <var>NULL</var>
  115. </td>
  116. <td>
  117. If the file has been encrypted and you want it decrypted (Both Server and Client Side), include the iv.
  118. </td>
  119. </tr>
  120. <tr>
  121. <td>
  122. <code>blockSize</code>
  123. </td>
  124. <td>
  125. <code>int</code>
  126. </td>
  127. <td>
  128. <var>@Model.Config.UploadConfig.BlockSize</var>
  129. </td>
  130. <td>
  131. The size of the iv provided in bytes. Only needed if encrypting and no iv is provided.
  132. </td>
  133. </tr>
  134. <tr>
  135. <td>
  136. <code>genDeletionKey</code>
  137. </td>
  138. <td>
  139. <code>bool</code>
  140. </td>
  141. <td>
  142. <var>false</var>
  143. </td>
  144. <td>
  145. Generates a deletion key.
  146. </td>
  147. </tr>
  148. </tbody>
  149. </table>
  150. <h4>Response</h4>
  151. <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>
  152. <table>
  153. <thead>
  154. <tr>
  155. <th>Name</th>
  156. <th>Type</th>
  157. <th>Description</th>
  158. </tr>
  159. </thead>
  160. <tbody>
  161. <tr>
  162. <td>
  163. <code>url</code>
  164. </td>
  165. <td>
  166. <code>string</code>
  167. </td>
  168. <td>
  169. The direct url to the uploaded file. The key is apended to the url as an anchor tag.
  170. </td>
  171. </tr>
  172. <tr>
  173. <td>
  174. <code>fileName</code>
  175. </td>
  176. <td>
  177. <code>string</code>
  178. </td>
  179. <td>
  180. The filename of the uploaded file.
  181. </td>
  182. </tr>
  183. <tr>
  184. <td>
  185. <code>contentType</code>
  186. </td>
  187. <td>
  188. <code>string</code>
  189. </td>
  190. <td>
  191. The MIME file type of the uploaded file.
  192. </td>
  193. </tr>
  194. <tr>
  195. <td>
  196. <code>contentLength</code>
  197. </td>
  198. <td>
  199. <code>integer</code>
  200. </td>
  201. <td>
  202. The size of the uploaded file in bytes.
  203. </td>
  204. </tr>
  205. <tr>
  206. <td>
  207. <code>key</code>
  208. </td>
  209. <td>
  210. <code>string</code>
  211. </td>
  212. <td>
  213. <strong>Optional</strong>
  214. The key that was used to encrypt the file.
  215. </td>
  216. </tr>
  217. <tr>
  218. <td>
  219. <code>keySize</code>
  220. </td>
  221. <td>
  222. <code>int</code>
  223. </td>
  224. <td>
  225. The size of the key used in bytes.
  226. </td>
  227. </tr>
  228. <tr>
  229. <td>
  230. <code>iv</code>
  231. </td>
  232. <td>
  233. <code>string</code>
  234. </td>
  235. <td>
  236. <strong>Optional</strong>
  237. The iv that was used to encrypt the file.
  238. </td>
  239. </tr>
  240. <tr>
  241. <td>
  242. <code>blockSize</code>
  243. </td>
  244. <td>
  245. <code>int</code>
  246. </td>
  247. <td>
  248. The size of the iv used in bytes.
  249. </td>
  250. </tr>
  251. <tr>
  252. <td>
  253. <code>deletionKey</code>
  254. </td>
  255. <td>
  256. <code>string</code>
  257. </td>
  258. <td>
  259. <strong>Optional</strong>
  260. The deletion key for file. Use it as follows: <code>@Url.SubRouteUrl("u", "Upload.Delete", new { file = "file.jpg", key = "deletionKey" })</code>
  261. </td>
  262. </tr>
  263. </tbody>
  264. </table>
  265. <h4>Example</h4>
  266. <pre><code>$ curl -F "genDeletionKey=true" -F "encrypt=true" -F "file=@("@")image.png" @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
  267. <p>
  268. This will upload the file <var>image.png</var>, encrypt it, and then generate a deletion key.
  269. </p>
  270. <br />
  271. <br />
  272. </div>
  273. </div>