audio-recodings: simpler upload

This commit is contained in:
Milan
2022-10-23 21:46:03 +02:00
parent c0b658abc0
commit 9d33fe5bdf
3 changed files with 9 additions and 13 deletions

View File

@@ -28,8 +28,6 @@ use time();
#$|=1; #$|=1;
binmode STDOUT, ":utf8"; binmode STDOUT, ":utf8";
my $useCgi = 0;
our $config = config::get('../config/config.cgi'); our $config = config::get('../config/config.cgi');
our $debug = $config->{system}->{debug}; our $debug = $config->{system}->{debug};
my $base_dir = $config->{locations}->{base_dir}; my $base_dir = $config->{locations}->{base_dir};
@@ -378,17 +376,14 @@ sub uploadFile {
print STDERR "tempFile=$tempFile\n"; print STDERR "tempFile=$tempFile\n";
my $start = time(); my $start = time();
open my $f, '>', $tempFile open my $out, '>', $tempFile
or return { error => 'could not save upload. ' . $! . " " . $tempFile }; or return { error => 'could not save upload. ' . $! . " " . $tempFile };
binmode $f; binmode $out;
my $size = 0; my $buffer='';
my $data = ''; print $out $buffer while read( $fh, $buffer, 4096 );
while ( my $bytesRead = $fh->read( $data, 65000 ) ) { close $out;
print $f $data;
$size += $bytesRead; my $size = (stat($tempFile))[7];
$data = '';
}
close $f;
return { return {
dir => $targetDir, dir => $targetDir,

View File

@@ -23,6 +23,7 @@ function changeFile(fileInput){
showError("file is too large. maximum size is 700 MB!"); showError("file is too large. maximum size is 700 MB!");
}else{ }else{
$('#uploadButton').show(); $('#uploadButton').show();
$('#uploadButton').focus();
} }
} }

View File

@@ -45,7 +45,7 @@
<td colspan="2" style="text-align:right;padding-right:0.5em;" id="uploadSize"></td> <td colspan="2" style="text-align:right;padding-right:0.5em;" id="uploadSize"></td>
<td colspan="2" style="text-align:right;padding-right:0.5em;" > <td colspan="2" style="text-align:right;padding-right:0.5em;" >
<button id="uploadButton" name="action" value="upload" >upload</button> <button id="uploadButton" name="action" value="upload" tabindex="0">upload</button>
</td> </td>
<td> <td>