Warning: session_start(): open(/var/lib/php/sessions/sess_ng4ha0t12nbo5k7o2d70tk74tp, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// super-short version
static String uploadData(S pathToDataFile) {
File file = new File(pathToDataFile);
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("http://tinybrain.de:8080/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);
}