2

I developing one gallery-component in joomla2.5 using uplodify

I have used the following code in view of my_component

    $session = & JFactory::getSession();
    $document = &JFactory::getDocument();
    $document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
    $document->addScript(JURI::root(true).'/administrator/components/com_mycomponent/uplodify/jquery.uploadify-3.1.min.js');
    $document->addStyleSheet(JURI::root(true).'/administrator/components/com_mycomponent/uplodify/uploadify.css');

    $UploadHeadJs ='

             // <![CDATA[
                jQuery.noConflict();
                jQuery(function() {
                console.log("load");    
                jQuery("#model_upload").uploadify({
                        "swf"      : "'.JURI::root(true).'/administrator/components/com_mycomponent/uplodify/uploadify.swf",
                        "uploader" : "index.php",
                        "formData" : {"option" : "com_mycomponent", "controller" : "uploadify","task":"uploadify.upload","'.$session->getName().'" : "'.$session->getId().'","cid":"'.$item->id.'","tmpl":"component"},
                        "method"   : "post",     
                        "cancelImg" : "'.JURI::root(true).'/administrator/components/com_mycomponent/uplodify/uploadify-cancel.png",
                        "uploadLimit" : 25,
                        "auto"      : true,
                        "buttonText" : "SELECT MODEL",
                        "debug"    : true,
                        "fileObjName" : "modelImage",
                        "fileSizeLimit" : "'.ini_get('upload_max_filesize').'B",
                        "fileTypeDesc"  : "Only 25 pictures allow(.jpeg,.gif)",
                        "fileTypeExts"  : "*.jpeg;*.jpg;*.JPEG;*.JPG;*.GIF;*.gif;*.png;*.PNG",
                        "multi"    : true,
                        "queueID"  : "queue",
                        "height"   : 22,
                        "onUploadError" : function(file, errorCode, errorMsg, errorString) {
                            console.log( errorMsg);
                         },
                        "onUploadSuccess" : function(file, data, response) {
                            console.log(response);
                         }
                        // Put your options here
                    });
                });
            //]]>';
            $document->addScriptDeclaration($UploadHeadJs);

In default.php contain the following code

<input type="file" name="modelUpload" id="model_upload"/>
       <div id="upload-queue-s" style="background:#CCCCCC">
        <div class="inQueu" id="queue"></div>
         <ul class="fileQueu">

            </ul>
        </div>

Uplodfiy is loading properly , now when i start the coding into controller and just try to echo something to confirm that requested url is working fine or not and it will redirect me the login page of administrator of joomla

so my issue is that why it redirect me the login page , is there issue with session ?? how can i get request form uplodify to joomla controller file ??

Hardik Raval
  • 1,948
  • 16
  • 29
  • I would try leaving the session pieces out of the formData section. You should not have to pass the session information back to the server in that way to make it work, and that would be the best guess I have on why it would kick you to a login page. – David Fritsch Aug 20 '12 at 22:18
  • Why not use RokGallery? It features support for multi-file uploads, among many other things. http://www.rockettheme.com/extensions-joomla/rokgallery – Ben Harold Dec 13 '12 at 23:59
  • @php_surgeon because it's not free , i have to first subscribe to use its services, well my code is working well now , thank you for your time. – Hardik Raval Dec 14 '12 at 09:14

1 Answers1

0

Try to do code in front side of component controller, as Joomla is not allowed to flash script to access administrator area without login.

I had also developed gallery component using uplodify and it's working fine. If you need it, I can provide you code for that.

Brian Mains
  • 50,520
  • 35
  • 148
  • 257