[EXTENSION] Java Uploader Extension

This is the support topic for Jumploader - Java Uploader

Hi, the extension looks great, however Im having some trouble when using it with CSRF validation, is there a way I can send this token with the upload request? thanks.

Just pass in attributes…

For more information read

http://www.jumploader.com/doc_attributes.html

Just add another attribute with the CSRF token name and value.

Thanks for the reply, however I was looking for a way of doing this without javascript, but reading through the jumploader forums I found that this is not currently supported.

hi!

I’ve this problem: the widget doesn’t show anything!

I’ve put this in the configuration file as written in the documentation:

            'jumploader' => array(


                'class' => 'ext.jumploader.jumploader',


            ),

in my view files i put this code:

<?php

$this->widget(‘ext.jumploader.jumploaderwidget’, array(

        'uploadUrlAction' =&gt; &#036;this-&gt;createUrl('controllerID/actionID'), // The uploader action that will handle the uploaded files, each file will send a request to this action


        'uploadDirectory' =&gt; Yii::getPathOfAlias('webroot.uploads'), // The uploaded directory, Basically this is only relevant if you use the Yii::app()-&gt;jumploader-&gt;uploadFiles() method that serves as a simple uploading method.


        'width'=&gt;900, // sets the applet width


        'allowedExtensions' =&gt; array( 'jpg', 'jpeg', 'gif', 'png' ), // array of allowed extensions to upload (without the prefix dot ( . ) )


        'height'=&gt;600, // sets the applet height


        'debugMode' =&gt; 'DEBUG', // enable debug allowed options are 'INFO', 'DEBUG', 'WARN', 'ERROR', 'FATAL', You can views those logs in the Java console. Defaults to false.


        'language' =&gt; 'fr', // Set the applet language, Currently there is a limited number of supported languages, Check the 'application/extensions/jumploader/jlassets/messages/ directory for the list of available languages.


        'maxFiles' =&gt; 5, // Number of maximum allowed files to upload. If the member refreshes the page this will be reset even if he previously uploaded. defaults to '-1' which means unlimited.


        'maxFileSize' =&gt; '17KB', // string that represents the maximum size of a single file uploaded, Examples: '10MB', '1024KB', '2GB' etc. Defaults to '-1' which means unlimited.


        'maxUploadSize' =&gt; '33KB', // string that represents the maximum size of total files uploaded, Examples: '10MB', '1024KB', '2GB' etc. Defaults to '-1' which means unlimited.


        ));

?>

but the page is blank even though the html code show me something…

<div id="content">

		&lt;br /&gt;

<applet

name=&quot;jumpLoaderApplet&quot; 


code=&quot;jmaster.jumploader.app.JumpLoaderApplet.class&quot; 


archive=&quot;/assets/99a97516/jumploader_z.jar&quot;


width=&quot;900&quot; 


height=&quot;600&quot; mayscript&gt;





					&lt;param name=&quot;uc_fileNamePattern&quot; value=&quot;^.+&#092;.(?i)((jpg)|(jpeg)|(gif)|(png))&#036;&quot;/&gt;





				&lt;param name=&quot;vc_fileNamePattern&quot; value=&quot;^.+&#092;.(?i)((jpg)|(jpeg)|(gif)|(png))&#036;&quot;/&gt;


				&lt;param name=&quot;uc_maxFiles&quot; value=&quot;5&quot;/&gt;


				&lt;param name=&quot;uc_maxFileLength&quot; value=&quot;17408&quot;/&gt;


				&lt;param name=&quot;uc_maxLength&quot; value=&quot;33792&quot;/&gt;


				&lt;param name=&quot;uc_uploadUrl&quot; value=&quot;/controllerID/actionID&quot;/&gt;


				&lt;param name=&quot;ac_messagesZipUrl&quot; value=&quot;/assets/99a97516/messages/messages_fr.zip&quot;/&gt;


				&lt;param name=&quot;gc_loggingLevel&quot; value=&quot;DEBUG&quot;/&gt;


				&lt;param name=&quot;vc_disableLocalFileSystem&quot; value=&quot;false&quot;/&gt;


				&lt;param name=&quot;vc_mainViewFileTreeViewVisible&quot; value=&quot;true&quot;/&gt;





				&lt;param name=&quot;vc_mainViewFileListViewVisible&quot; value=&quot;true&quot;/&gt;


				&lt;param name=&quot;vc_lookAndFeel&quot; value=&quot;system&quot;/&gt;

</applet>

	&lt;/div&gt;&#60;&#33;-- content --&#62;

Where’s the mistake?

It seems like the $uploadDirectory variable cannot be set in the configuration.I have to dig in the uploadFiles() method in jumploader.php to specify the upload directory in the move_uploaded_file() argument.Weird.Anybody else has experienced that?

Need to fix extensions/jumploader/views/jumploader.php, on line 76:




Yii::app()->jumploader->appletOptions = Yii::app()->jumploader->appletOptions + Yii::app()->jumploader->defaultAppletOptions;



In the other way $arrayOptions is always overwritten by $defaultArrayOptions

For CSRF token support:

In your view, add this Javascript code:




<script type="text/javascript">

	function addJumpLoaderAttr(name, value) {

		var uploader = document.jumpLoaderApplet.getUploader();

		var attrSet = uploader.getAttributeSet();

		var attr = attrSet.createStringAttribute(name, value);

		attr.setSendToServer(true);

	}


	function appletInitialized(applet) {

		var name = "<?php echo Yii::app()->request->csrfTokenName; ?>";

		var value = "<?php echo Yii::app()->request->csrfToken; ?>";

		addJumpLoaderAttr(name, value);

	}

</script>



Your applet configuration should look like this (in the same view):




$this->widget('ext.jumploader.jumploaderwidget', array(

		'uploadUrlAction' => '/admin/offer/upload',

		'width' => 690,

		'height' => 600,

		'appletOptions' => array(

			'vc_mainViewFileTreeViewVisible' => false,

			'vc_mainViewFileListViewVisible' => false,

			'vc_lookAndFeel' => 'system',

			'ac_fireAppletInitialized' => true,

		),

	));



The important line here is “‘ac_fireAppletInitialized’ => true,”. It runs the appletInitialized() function just after the applet is completely loaded.

You can also add as many parameters as you want calling addJumpLoaderAttr() from appletInitialized(). Those parameters are sended, as the JumpLoader documentation says, in $_POST.

Hey, guys!

First of all, excellent extension! I’m switching from my old sfancyupload to it right now!

I’ve just translated the messages to Portuguese (Brazil)

If somebody wants the file, it follows attached!

Thanks and regards

1518

messages_br.zip

tks! confirmed! i’ve tried in appletOptions




'vc_mainViewFileListViewVisible' => false,



and it only worked after @chirvo’s tip

regards!

Hi,

Not sure if this is the correct forum to ask, so apologies if this should have been posted elsewhere.

I’ve been looking into extensions that will enable my users to upload multiple pictures. I’ve managed to setup this extension pretty straightforward, and it all works beautifully using an upload action that uses Yii::app()->jumploader->uploadFiles(). Now, here is the scenario that I have some trouble with…

All the uploaded files need to be processed after uploading, and each the url of each file associated with a user by recording it in a database. As far as I can tell, it means that if a user uploads 30 pictures, it is similar to 30 times submitting a form with one upload field. Obviously, I don’t want to query the database 30 times with individual insert statements.

How would I go about this? I could store an accumulated array of file objects in session and process them once the uploads are done. But is there a way for this extension / Jumploader to signal to the server that it is done? Is there a better way in the first place?

Thanks!

“normally”, when you use an uploader to upload multiple files, you’d get an array of uploaded files.

You can use that to perform actions on them, like storing them in the db, etc.

At least that’s what the Uploadify Yii extension does IIRC.

That was actually what I was expecting, but as far as I can tell this extension processes them one (POST request) at a time. I’m not ruling out I’m missing something obvious here though, I just haven’t found it yet.