From 609db88f316604bf1084dbb0defe5e6c0eaf07ae Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 25 Apr 2009 14:47:16 -0400 Subject: Add MIME type to file --- src/c/driver.c | 2 +- src/c/urweb.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/c/driver.c b/src/c/driver.c index 6e06f32b..c95f8886 100644 --- a/src/c/driver.c +++ b/src/c/driver.c @@ -393,7 +393,7 @@ static void *worker(void *data) { part += boundary_len; if (filename) { - uw_Basis_file f = {filename, {part_len, after_sub_headers}}; + uw_Basis_file f = {filename, type, {part_len, after_sub_headers}}; uw_set_file_input(ctx, name, f); } else diff --git a/src/c/urweb.c b/src/c/urweb.c index a73371ef..ff4d5c8f 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -632,7 +632,7 @@ uw_Basis_file uw_get_file_input(uw_context ctx, int n) { case UNSET: { char *data = uw_malloc(ctx, 0); - uw_Basis_file f = {"", {0, data}}; + uw_Basis_file f = {NULL, "", {0, data}}; return f; } case FIL: @@ -2128,6 +2128,10 @@ uw_Basis_string uw_Basis_fileName(uw_context ctx, uw_Basis_file f) { return f.name; } +uw_Basis_string uw_Basis_fileMimeType(uw_context ctx, uw_Basis_file f) { + return f.type; +} + uw_Basis_blob uw_Basis_fileData(uw_context ctx, uw_Basis_file f) { return f.data; } -- cgit v1.2.3