Transpiled version (3872L) is out of date.
// super-short version static String uploadData(S pathToDataFile) { File file = new File(pathToDataFile); ret uploadData(programID(), file.getAbsolutePath(), file); } sS uploadData(File file) { ret uploadData(programID(), file.getAbsolutePath(), file); } static String uploadData(String gummipw, String title, File dataFile) ctex { return uploadData(gummipw, title, loadBinaryFile(dataFile), false); } static String uploadDataSuperHigh(String gummipw, String title, File dataFile) ctex { return uploadData(gummipw, title, loadBinaryFile(dataFile), true); } static String uploadData(String gummipw, String title, byte[] data) throws IOException { return uploadData(gummipw, title, data, false); } static String uploadData(String gummipw, String title, byte[] data, boolean superhigh) throws IOException { if (gummipw == null || gummipw.length() == 0) throw new RuntimeException("Need gummi password."); System.out.println("Uploading:"); System.out.println(" gummipw: " + gummipw); System.out.println(" " + title); int displayLength = 40; System.out.println(" " + data.length + " bytes of data"); URL url = new URL(tb_mainServer() + "/tb-int/add_snippet.php"); String postData = "gummipw=" + URLEncoder.encode(unnull(gummipw), "UTF-8") + "&blob=" + URLEncoder.encode(base64encode(data), "UTF-8") + "&name=" + URLEncoder.encode(unnull(title), "UTF-8") + "&type=" + 37 /* SN_DATA */ + "&" + (superhigh ? "superhigh" : "high") + "=1&public=1"; System.out.println("Post data length: " + postData.length()); String contents = doPost(postData, url.openConnection(), url); System.out.println(contents); if (isInteger(contents)) { long id = parseSnippetID(contents); System.out.println("=> #" + id); return "#" + id; } else throw new RuntimeException("Server error: " + contents); }
Began life as a copy of #1000741
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, kmhbujppghqa, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1000754 |
Snippet name: | uploadData function |
Eternal ID of this version: | #1000754/4 |
Text MD5: | 26eaeb90d771813c7e8f62b07d20090b |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-02 16:27:53 |
Source code size: | 1916 bytes / 51 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 803 / 1111 |
Version history: | 3 change(s) |
Referenced in: | [show references] |