X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Ffile-upload.html;h=469274c697b94cfcb4ca657772b57d372331d6b7;hp=9649d366348fd7adcd21f4b92b2c2f33d46ba84c;hb=cee66872f5c67825cae5a0f86da3fb0657c4ebae;hpb=6a24254d490f3d023728044daba0765f20f6971e 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, )