I have created a upload modal field to upload content into the images directory and it all works perfectly fine, except the redirect after the upload.

This is the upload Form in the modal window:

<form action="<?php echo JUri::base(); ?>index.php?option=com_file_manager&amp;task=file.upload&amp;tmpl=component&amp;<?php echo $this->session->getName() . '=' . $this->session->getId(); ?>&amp;<?php echo JSession::getFormToken();?>=1&amp;view=file" id="uploadForm" class="form-horizontal" name="uploadForm" method="post" enctype="multipart/form-data">
    <div id="uploadform" class="well">
        <fieldset id="upload-noflash" class="actions">
            <div class="control-group">
                <div class="control-label">
                    <label for="upload-file" class="control-label"><?php echo JText::_('COM_MEDIA_UPLOAD_FILE'); ?></label>
                <div class="controls">
                    <input type="file" id="upload-file" name="Filedata[]" multiple /><button class="btn btn-primary" id="upload-submit"><i class="icon-upload icon-white"></i> <?php echo JText::_('COM_MEDIA_START_UPLOAD'); ?></button>
                <input type="hidden" name="return-url" value="<?php echo base64_encode('index.php?option=com_fal_manager&amp;view=file&amp;layout=modal&amp;tmpl=component'); ?>" />


And this is how the redirect looks in the controller:

public function upload() {
        // Check for request forgeries
        JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));
        $files        = $this->input->files->get('Filedata', '', 'array');
        $return       = $this->input->post->get('return-url', null, 'base64');
        $this->folder = $this->input->get('folder', '', 'path');
        if ($return) {

I just need it to take me back to the original place i was before i uploaded it, the url of the modal is:


and after upload:


Weird I know, its the same url, but its not the same page.. It takes me to the list view of that page.

Any Help Greatly Appreciated

  • Where does this modal field reside? Is this a custom component you are building?
    – FFrewin
    Commented May 19, 2014 at 21:15

2 Answers 2


The problem turned out to be something as simple as &amp;, Simple changing:

<input type="hidden" name="return-url" value="<?php echo base64_encode('index.php?option=com_file_manager&amp;view=file&amp;layout=modal&amp;tmpl=component'); ?>" />


<input type="hidden" name="return-url" value="<?php echo base64_encode('index.php?option=com_file_manager&view=file&layout=modal&tmpl=component'); ?>" />

Did the trick. Thank you all for your inputs.


You have view=files in your return-url hidden input of the form. Then in the controller you assign it to $return var and redirect using it. That is why you are being redirect to the list view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.