diff options
author | Yorhel <git@yorhel.nl> | 2008-10-22 17:15:17 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-10-22 17:15:17 +0200 |
commit | 6cce43e53da9a43bfca7c1f37f7d53936e130da0 (patch) | |
tree | 0446f78a3d570523f8a5a1b9ad7cc071a1f849ac | |
parent | 924792ce0009801b3ed2415ff4bbebed5ef8cb0f (diff) |
Improved file uploading support in Request.pm
-rw-r--r-- | lib/YAWF/Request.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/YAWF/Request.pm b/lib/YAWF/Request.pm index 09f12e4..59d28a6 100644 --- a/lib/YAWF/Request.pm +++ b/lib/YAWF/Request.pm @@ -49,6 +49,23 @@ sub reqParam { } +# returns the MIME Type of an uploaded file, requires form name as argument, +# can return an array if multiple file uploads have the same form name +sub reqUploadMIME { + my $c = shift->{_YAWF}{Req}{c}; + return $c->param_mime(shift); +} + + +# same as reqUploadMIME, only this one fetches filenames +sub reqUploadFileName { + my $c = shift->{_YAWF}{Req}{c}; + return $c->param_filename(shift); +} + + +# saves file contents identified by the form name to the specified file +# (doesn't support multiple file upload using the same form name yet) sub reqSaveUpload { my($s, $n, $f) = @_; open my $F, '>', $f or die "Unable to write to $f: $!"; |