Libraryless. Click here for Pure Java version (5279L/36K).
1 | sS uploadToFileServerWithFixedID(File f, S name, S snippetID) { |
2 | ret uploadToFileServerWithFixedID(loadBinaryFile(f), name, snippetID); |
3 | } |
4 | |
5 | sS uploadToFileServerWithFixedID(byte[] data, S name, S snippetID) { |
6 | print("Uploading " + l(data) + " bytes (" + quote(name) + ") to file server with id " + fsI(snippetID)); |
7 | S page = postPage("http://butter.botcompany.de:8080/files/upload", "data", bytesToHex(data), "name", name, "id", psI(snippetID), '_pass, muricaPassword()); |
8 | print(page); |
9 | Matcher m = Pattern.compile("/raw/([0-9]+)").matcher(page); |
10 | if (!m.find()) fail("File server said: " + page); |
11 | S url = "http://butter.botcompany.de:8080/files/" + m.group(1); |
12 | infoBox("Uploaded: " + url); |
13 | ret url; |
14 | } |
Began life as a copy of #1015418
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1026058 |
Snippet name: | uploadToFileServerWithFixedID (migrate legacy snippets) |
Eternal ID of this version: | #1026058/3 |
Text MD5: | a42306309665da8438395f42a5e96ad1 |
Transpilation MD5: | 363d9ce40c4c3e5fdc689061b7acd9d7 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-11-18 20:36:22 |
Source code size: | 725 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 232 / 288 |
Version history: | 2 change(s) |
Referenced in: | [show references] |