X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fgraphics.c;h=3c16baf414e218dd2c91fa16de6880e26ced0bcd;hb=6ec27c3dc0bfb0ffd82a2ec5c4e37869ef0076c9;hp=3179d580f01bb33c789f2e3c7628b40f868ec4d7;hpb=01feb53d65843a957635a16c3cccafe2b718777a;p=citadel.git diff --git a/webcit/graphics.c b/webcit/graphics.c index 3179d580f..3c16baf41 100644 --- a/webcit/graphics.c +++ b/webcit/graphics.c @@ -7,11 +7,13 @@ #include "webcit.h" -void display_graphics_upload(char *description, char *check_cmd, char *uplurl) +void display_graphics_upload(char *description, char *filename, char *uplurl) { char buf[SIZ]; - serv_puts(check_cmd); + + snprintf(buf, SIZ, "UIMG 0||%s", filename); + serv_puts(buf); serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); @@ -33,12 +35,14 @@ void display_graphics_upload(char *description, char *check_cmd, char *uplurl) urlescputs(bstr("which_room")); wprintf("\">\n"); - wprintf(_("You can upload any image directly from your computer, " - "as long as it is in GIF, JPEG or PNG")); + wprintf(_("You can upload an image directly from your computer")); wprintf("

\n"); wprintf(_("Please select a file to upload:")); wprintf("\n"); + + wprintf("
\n", filename); + wprintf("
"); wprintf("\n", _("Upload")); wprintf(" "); @@ -53,12 +57,14 @@ void display_graphics_upload(char *description, char *check_cmd, char *uplurl) wDumpContent(1); } -void do_graphics_upload(char *upl_cmd) +void do_graphics_upload(char *filename) { + const char *MimeType; char buf[SIZ]; int bytes_remaining; int pos = 0; int thisblock; + bytes_remaining = WC->upload_length; if (!IsEmptyStr(bstr("cancel_button"))) { strcpy(WC->ImportantMessage, @@ -73,14 +79,17 @@ void do_graphics_upload(char *upl_cmd) display_main_menu(); return; } - serv_puts(upl_cmd); + + MimeType = GuessMimeType(&WC->upload[0], bytes_remaining); + snprintf(buf, SIZ, "UIMG 1|%s|%s", MimeType, filename); + serv_puts(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); display_main_menu(); return; } - bytes_remaining = WC->upload_length; while (bytes_remaining) { thisblock = ((bytes_remaining > 4096) ? 4096 : bytes_remaining); serv_printf("WRIT %d", thisblock);