Using OMP file upload for plugins


I want to use the OMP file upload for plugins. I have created a form, the OMP file upload container is displayed and I can select a file. When clicking on “Start upload” however, control is not going back to my form class (function “uploadFile”) and thus the upload fails, the file’s name turns red. I assume “uploadUrl” is wrong (…/grid/settings/plugins/settings-plugin-grid/upload-file), it is contructed in PKPPageRouter, function “url”.

Is it possible to use the OMP file upload in plugins? Is there maybe an example I could use? Or is there a better way to construct the upload url?


<script type="text/javascript">
    // Attach the file upload form handler.
    $(function() {ldelim}
                $uploader: $('#plupload'),
                uploaderOptions: {ldelim}
                    uploadUrl: '{url|escape:javascript op="uploadFile" fileSettingName=$fileSettingName fileType=$fileType escape=false}',
                    baseUrl: '{$baseUrl|escape:javascript}'

<form id="uploadForm" class="pkp_form" action="{url op="saveFile" fileSettingName=$fileSettingName fileType=$fileType}" method="post">
    <input type="hidden" name="temporaryFileId" id="temporaryFileId" value="" />
    {fbvFormArea id="file"}
        {fbvFormSection title="common.file"}
            {include file="controllers/fileUploadContainer.tpl" id="plupload"}


Hi @carola,

It’s totally fine to use the system upload feature in plugins. You can check that’s being used already by the users import plugin. Check the code at both plugins/importexport/users and lib/pkp/plugins/importexport/users to see how it is done.

I would guess that you didn’t implemented the upload method inside your plugin. Look at how the users plugin solves that: it defines the uploadUrl using a path and that request is handled by the plugin display method, checking the path for the action.

You can replicate that to get your plugin upload file working.


Thanks a lot, Bruno!

I found it now, it’s

uploadUrl: ‘{plugin_url path="…"}’