Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1026058 // uploadToFileServerWithFixedID (migrate legacy snippets)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5279L/36K).

sS uploadToFileServerWithFixedID(File f, S name, S snippetID) {
  ret uploadToFileServerWithFixedID(loadBinaryFile(f), name, snippetID);
}

sS uploadToFileServerWithFixedID(byte[] data, S name, S snippetID) {
  print("Uploading " + l(data) + " bytes (" + quote(name) + ") to file server with id " + fsI(snippetID));
  S page = postPage("http://butter.botcompany.de:8080/files/upload", "data", bytesToHex(data), "name", name, "id", psI(snippetID), '_pass, muricaPassword());
  print(page);
  Matcher m = Pattern.compile("/raw/([0-9]+)").matcher(page);
  if (!m.find()) fail("File server said: " + page);
  S url = "http://butter.botcompany.de:8080/files/" + m.group(1);
  infoBox("Uploaded: " + url);
  ret url;
}

Author comment

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: 116 / 173
Version history: 2 change(s)
Referenced in: [show references]