0

I am new in joomla. a create a basic module for joomla.this is my file structure in my module.

mod_upload.xml
mod_upload.php
helper.php

i put this form in helper.php

<form action="mod_upload.php" method="post"
enctype="multipart/form-data">
Filename:
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>

and I know this is not working because I put this code in my php file.

defined('_JEXEC') or die('Restricted access');

for now I want to know how to set action for form to send my file from helper.php to mod_upload.php

adib16
  • 1,649
  • 2
  • 20
  • 35
  • 1
    Not a Joomla expert, but when I Google `create a simple file upload in joomla` I get several tutorials and other resources, one of them might be useful? – Pekka Dec 22 '13 at 20:33
  • I do search before asking question.but i do not found any resource about my question . – adib16 Dec 22 '13 at 20:39
  • 1
    Have a look at module development on the Joomla Docs. The html structure doesn't go in the helper.php, it goes in the default.php. I answered your question which is basically the same as this one a while back: http://stackoverflow.com/questions/20659236/how-to-set-action-to-form-in-joomla-modules/20659413#20659413 – Lodder Dec 22 '13 at 21:11

1 Answers1

0

Create folder tmpl and create there file default.php. And in her place form and in action write this:

<?php echo JRoute::_('index.php'); ?>

In helper.php make processing function. For example PostForm

class modUpload
{
    static function PostForm()
    {
              $post = JRequest::get('post'); //It's params of post form
    }


}

In mod_upload.php call this function:

defined('_JEXEC') or die;
require_once dirname(__FILE__).'/helper.php';

modUploadHelper::PostForm(); //It's


require JModuleHelper::getLayoutPath('mod_upload', $params->get('layout', 'default'));