X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fdownloads.c;h=18a136734e756b416ff1eb0d6b9697fee681b536;hb=1638755b1a025a11d8e837f02d3e6f2d5df255cb;hp=4a2352d700fe7335bd538955c2b37692710b8c8e;hpb=839760156cc8c20d7df494fdcdac5ad28e26f32e;p=citadel.git
diff --git a/webcit/downloads.c b/webcit/downloads.c
index 4a2352d70..18a136734 100644
--- a/webcit/downloads.c
+++ b/webcit/downloads.c
@@ -50,7 +50,31 @@ void display_room_directory(void)
wprintf("\n");
}
- wprintf("\n");
+ wprintf("\n");
+
+ /** Now offer the ability to upload files... */
+ if (WC->room_flags & QR_UPLOAD)
+ {
+ wprintf("
");
+ wprintf("\n");
+ }
+
+ wprintf("\n");
wDumpContent(1);
}
@@ -92,3 +116,42 @@ void download_file(char *filename)
}
+
+
+void upload_file(void)
+{
+ char buf[1024];
+ size_t bytes_transmitted = 0;
+ size_t blocksize;
+
+ serv_printf("UOPN %s|%s", WC->upload_filename, bstr("description"));
+ serv_getln(buf, sizeof buf);
+ if (buf[0] != '2')
+ {
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_room_directory();
+ return;
+ }
+
+ while (bytes_transmitted < WC->upload_length)
+ {
+ blocksize = 4096;
+ if (blocksize > (WC->upload_length - bytes_transmitted))
+ {
+ blocksize = (WC->upload_length - bytes_transmitted);
+ }
+ serv_printf("WRIT %d", blocksize);
+ serv_getln(buf, sizeof buf);
+ if (buf[0] == '7')
+ {
+ blocksize = atoi(&buf[4]);
+ serv_write(&WC->upload[bytes_transmitted], blocksize);
+ bytes_transmitted += blocksize;
+ }
+ }
+
+ serv_puts("UCLS 1");
+ serv_getln(buf, sizeof buf);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_room_directory();
+}