OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Disable file renaming on upload; similar method to OJS?

Are you responsible for making OMP work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, asmecher

Forum rules
What to do if you have a technical problem with OMP:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OMP Discussion subforum; if you have a development question, try the OMP Development subforum.

Disable file renaming on upload; similar method to OJS?

Postby texteditor » Mon May 20, 2013 11:12 am

Hello,

According to this forum thread, there are ways in OJS to preserve the original filename or select "Custom Identifiers" on upload.

Changing Filename when upload
viewtopic.php?f=8&t=3379&p=12470&hilit=rename#p12470

Is there any way to do this with OMP?

I see that in OMP Management>Settings>Publication that we can change the prexfix for genre association, but that is all. Thanks.
texteditor
 
Posts: 2
Joined: Mon May 20, 2013 10:45 am

Re: Disable file renaming on upload; similar method to OJS?

Postby asmecher » Tue May 21, 2013 10:36 am

Hi texteditor,

To preserve the original upload filename, try the following (untested but uncomplicated) modification:
  • Open classes/file/MonographFileManager.inc.php
  • Find the "downloadFile" function
  • Find the call to parent::downloadFile in that function:
    Code: Select all
    $returner = parent::downloadFile($filePath, $mediaType, $inline);
  • Change it to include the optional 4th parameter for download filename:
    Code: Select all
    $returner = parent::downloadFile($filePath, $mediaType, $inline, $monographFile->getOriginalFileName());
Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8426
Joined: Wed Aug 10, 2005 12:56 pm

Re: Disable file renaming on upload; similar method to OJS?

Postby texteditor » Tue May 28, 2013 11:29 am

Thank you. It works with new submissions and new presses.

It also works in most of our older presses (created before the code change), but not all of them. Not sure why at this point. We don't have a lot of older presses so it isn't a total concern for us.


Another question - is there a way to similarly allow the 'cover' images to retain their original filename?

We feel it will help with SEO and general organization if the cover images keep their original names (usually we name the images with the title of the monograph or something similar that is identifiable)
texteditor
 
Posts: 2
Joined: Mon May 20, 2013 10:45 am

Re: Disable file renaming on upload; similar method to OJS?

Postby asmecher » Mon Jun 03, 2013 3:24 pm

Hi texteditor,

There will be a scattering of additional modifications to get the same thing to happen in other places; unfortunately unless a number of users start to squawk, or a serious hit to SEO can be demonstrated, it's not a change I can sink time into at the moment. I will keep my ears open for similar feedback, though.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8426
Joined: Wed Aug 10, 2005 12:56 pm


Return to OMP Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest