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

View File

@@ -23,6 +23,7 @@ function changeFile(fileInput){
showError("file is too large. maximum size is 700 MB!");
}else{
$('#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;" >
<button id="uploadButton" name="action" value="upload" >upload</button>
<button id="uploadButton" name="action" value="upload" tabindex="0">upload</button>
</td>
<td>