diff options
Diffstat (limited to 'httemplate/misc/file-upload.html')
-rw-r--r-- | httemplate/misc/file-upload.html | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/httemplate/misc/file-upload.html b/httemplate/misc/file-upload.html index 9649d3663..469274c69 100644 --- a/httemplate/misc/file-upload.html +++ b/httemplate/misc/file-upload.html @@ -2,7 +2,7 @@ % if ($error) { Error: <% $error %> % }else{ -Freeside File Upload Successful <% join(',', @filenames) %>; +File Upload Successful <% join(',', @filenames) %>; % } <% include('/elements/footer.html') %> <%init> @@ -17,7 +17,7 @@ $cgi->param('upload_fields') =~ /^([,\w]+)$/ or $error = "invalid upload_fields"; my $fields = $1; -my $dir = $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc; +my $dir = $FS::UID::cache_dir. "/cache.". $FS::UID::datasrc; foreach my $field (split /,/, $fields) { next if $error; @@ -25,7 +25,13 @@ foreach my $field (split /,/, $fields) { my $fh = $cgi->upload($field) or $error = "No valid file was provided."; + my $suffix = ''; + if ( $cgi->param($field) =~ /(\.\w+)$/i ) { + $suffix = lc($1); + } + my $sh = new File::Temp( TEMPLATE => 'upload.XXXXXXXX', + SUFFIX => $suffix, DIR => $dir, UNLINK => 0, ) |