coral-erm / coral

CORAL ERM main repository
http://coral-erm.org/
Other
52 stars 65 forks source link

MAX_FILE_SIZE size error on uploading a COUNTER5 file #676

Open kfischer opened 3 years ago

kfischer commented 3 years ago

We have just updated to the 2020.09 release and have started testing the COUNTER5 functionality.

I have tried to upload a .tsv file provided by one of our libraries and receive the following error:

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form

What I did:

When I open the file in any editor it appears as tab separated text file as expected. The file size is 9,72 KB

In the source and help text I can see the limit should be 5 MB: File may not be larger than 5MB

<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />

Any help much appreciated!

kfischer commented 3 years ago

We figured out that the counterstore directory didn't have the correct permissions.

The somewhat confusing error message is triggered by this bit of code and the move_uploaded_file failing:

  if(move_uploaded_file($_FILES['usageFile']['tmp_name'], $targetPath)) {
    $page['status'][] = _("The file "). $pathInfo['basename'] ._(" has been uploaded successfully.")."<br />"._("Please confirm the following data:")."<br />";
  } else{
    header( 'Location: import.php?error=2' ) ;
  }

Maybe using a different error code than 2 or giving a specific error for this method failing would be a good fix here.

jzairo commented 3 years ago

Just to confirm, we are getting the same error message when testing.