Bug 34478: Changes for tools/upload-images

First upload form does not submit (ajax processing).

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2024-02-09 08:36:59 +00:00 committed by Jonathan Druart
parent 03941cc684
commit 4f63ac9dff
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
2 changed files with 6 additions and 7 deletions

View File

@ -183,8 +183,7 @@
<div class="col-sm-12">
[% END %]
<form method="post" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
[% INCLUDE 'csrf-token.inc' %]
<form method="get" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
<fieldset class="rows" >
<div id="fileuploadform">
<label for="fileToUpload">Select the file to upload: </label>
@ -209,6 +208,7 @@
<form method="post" id="processfile" action="/cgi-bin/koha/tools/upload-cover-image.pl" enctype="multipart/form-data">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-process" />
<input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
[% IF itemnumber %]

View File

@ -67,10 +67,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $filetype = $input->param('filetype');
my $biblionumber = $input->param('biblionumber');
my $itemnumber = $input->param('itemnumber');
#my $uploadfilename = $input->param('uploadfile'); # obsolete?
my $replace = !C4::Context->preference("AllowMultipleCovers")
|| $input->param('replace');
my $op = $input->param('op');
my $replace = !C4::Context->preference("AllowMultipleCovers")
|| $input->param('replace');
my $op = $input->param('op') // q{};
my $error;
@ -99,7 +98,7 @@ $template->param(
my $total = 0;
my @results;
if ($fileID) {
if ( $op eq 'cud-process' & $fileID ) {
my $upload = Koha::UploadedFiles->find( $fileID );
if ( $filetype eq 'image' ) {
my $fh = $upload->file_handle;