// 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); }