10 #include <sys/socket.h>
13 #include <netinet/in.h>
23 void display_graphics_upload(char *description, char *check_cmd, char *uplurl)
30 strcpy(WC->ImportantMessage, &buf[4]);
36 svprintf("BOXTITLE", WCS_STRING, "Set/change your photo");
37 do_template("beginbox");
39 wprintf("<CENTER>\n");
41 wprintf("<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"%s\" "
42 "METHOD=\"POST\" NAME=\"graphicsupload\">\n", uplurl);
44 wprintf("<INPUT TYPE=\"hidden\" NAME=\"which_room\" VALUE=\"");
45 urlescputs(bstr("which_room"));
48 wprintf("You can upload any image directly from your computer,\n");
49 wprintf("as long as it is in GIF format (JPEG, PNG, etc. won't\n");
50 wprintf("work).<BR><BR>\n");
52 wprintf("Please select a file to upload:<BR><BR>\n");
53 wprintf("<INPUT TYPE=\"FILE\" NAME=\"filename\" SIZE=\"35\">\n");
55 wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" VALUE=\"Upload\">\n");
56 wprintf("<INPUT TYPE=\"RESET\" VALUE=\"Reset Form\">\n");
57 wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" VALUE=\"Cancel\">\n");
59 wprintf("</CENTER>\n");
60 do_template("endbox");
64 void do_graphics_upload(char *upl_cmd)
71 if (!strcasecmp(bstr("sc"), "Cancel")) {
72 strcpy(WC->ImportantMessage,
73 "Graphics upload cancelled.");
78 if (WC->upload_length == 0) {
79 strcpy(WC->ImportantMessage,
80 "You didn't upload a file.");
87 strcpy(WC->ImportantMessage, &buf[4]);
91 bytes_remaining = WC->upload_length;
92 while (bytes_remaining) {
93 thisblock = ((bytes_remaining > 4096) ? 4096 : bytes_remaining);
94 serv_printf("WRIT %d", thisblock);
97 strcpy(WC->ImportantMessage, &buf[4]);
103 thisblock = extract_int(&buf[4], 0);
104 serv_write(&WC->upload[pos], thisblock);
105 pos = pos + thisblock;
106 bytes_remaining = bytes_remaining - thisblock;
112 display_success(&buf[4]);