<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matt+nz</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matt+nz"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Matt_nz"/>
	<updated>2026-08-17T23:52:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=62073</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=62073"/>
		<updated>2011-09-13T22:29:18Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* The entire script.php file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version 1.6 or greater is in use.  If an earlier Joomla version is in use, the install or update will abort.  Since this script.php file only works in Joomla version 1.6 or greater, this check is currently not very useful.  As subsequent Joomla versions become available, this check will be useful.  Try changing the version string in the script.php file to a value greater than the Joomla version that you are using.  Installs and updates should fail.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), &#039;1.6&#039;, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to 1.6&#039;);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an install, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Initial installs have these parameters defined.  Updates over-write the values of these parameters.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// set initial values for component parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
	$params[&#039;my_param2&#039;] = &#039;Still yet another value&#039;;&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
		&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value would ideally be extracted from &amp;lt;version&amp;gt; in the manifest file,&lt;br /&gt;
	 * but at preflight, the manifest file exists only in the uploaded temp folder.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), &#039;1.6&#039;, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to 1.6&#039;);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// set initial values for component parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;Still yet another value&#039;;&lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=21886</id>
		<title>Archived:Creating a file uploader in your component</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=21886"/>
		<updated>2010-02-25T01:05:44Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Part 1: Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating a file uploader in your component: Method 1, SWFUpload ==&lt;br /&gt;
&lt;br /&gt;
=== Part 1: Introduction ===&lt;br /&gt;
&lt;br /&gt;
SWFUpload is a free open source multiple file uploader available for download from http://swfupload.org/&lt;br /&gt;
&lt;br /&gt;
A demo of swfupload is available here: http://demo.swfupload.org/v220/simpledemo/index.php&lt;br /&gt;
&lt;br /&gt;
The standard way to upload a file is with a HTML form. This works great if you are uploading one file, but browsers do not let you select and upload more than one file at a time (Update Feb 2010, Firefox 3.5+ and some other modern browsers support the HTML5 multiple file input)&lt;br /&gt;
&lt;br /&gt;
The most common way of selecting multiple files for upload is to use flash and javascript. The flash part of the script opens up a select file dialog where multiple files can be selected, and the flash/javascript sends each file, and recieves the response from the server.&lt;br /&gt;
&lt;br /&gt;
The most popular scripts used to do this are SWFUpload and Fancy upload (http://digitarald.de/project/fancyupload/). The flash uploader in Joomla&#039;s media manager is based on Fancy Upload version 1.0. As Fancy upload 2.0 and 3.0 use mootools 1.2, and Joomla 1.5 uses mootools 1.11, we can not use Fancy Upload 2.0/3.0 in the admin pages of Joomla. Fancy Upload 1.0 could be used, but it is not updated or supported anymore.&lt;br /&gt;
&lt;br /&gt;
SWFUpload does not use Mootools or Jquery. Because of this it will likely work on any page with Mootools 1.11 (Joomla 1.5), or Mootools 1.2 (Joomla 1.6). Therefore we will be using SWFUpload in this article.&lt;br /&gt;
&lt;br /&gt;
Download ths latest version of SWFUpload from the download page (http://code.google.com/p/swfupload/). Download the SWFUpload v2.2.0.1 Samples.zip file.&lt;br /&gt;
&lt;br /&gt;
Inside the file there will be a demos folder, and inside that a simpledemo folder. This is the example we are going to integrate into a Joomla component.&lt;br /&gt;
&lt;br /&gt;
This tutorial assumes you have followed the http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 tutorial and are familiar with Joomla&#039;s MVC structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 2: Adding The External Javascript ===&lt;br /&gt;
&lt;br /&gt;
We need to add in the external links in the head of the document, put some javascript into the head of the doc, and put some HTML in our body.&lt;br /&gt;
&lt;br /&gt;
If you look at the simpledemo/index.php page you will see links to 5 files in the head of the page.&lt;br /&gt;
&lt;br /&gt;
Make a folder within the root of your components folder called swfupload, copy the ../css/default.css, ../swfupload/swfupload.js, js/swfupload.queue.js, js/fileprogress.js and js/handlers.js files into this folder.&lt;br /&gt;
&lt;br /&gt;
We also need to copy the ../swfupload/swfupload.swf and images/TestImageNoText_65x29.png files into this folder.&lt;br /&gt;
&lt;br /&gt;
Within your view.html.php file add in the following code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//get the hosts name&lt;br /&gt;
jimport(&#039;joomla.environment.uri&#039; );&lt;br /&gt;
$host = JURI::root();&lt;br /&gt;
&lt;br /&gt;
//add the links to the external files into the head of the webpage (note the &#039;administrator&#039; in the path, which is not nescessary if you are in the frontend)&lt;br /&gt;
$document =&amp;amp; JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.queue.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/fileprogress.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/handlers.js&#039;);&lt;br /&gt;
$document-&amp;gt;addStyleSheet($host.&#039;administrator/components/com_mycomponent/swfupload/default.css&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
That is the external files part done. We still have to add in the head javascript, and the body html.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Part 3: Adding The Head Javascript ===&lt;br /&gt;
&lt;br /&gt;
Head javascript part:&lt;br /&gt;
The javascript below is almost the same as the javascript from the simple demo, the few modifications are commented. It is nescessary to read through it and change the parts (such as task) that are relevant to your component.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//when we send the files for upload, we have to tell Joomla our session, or we will get logged out &lt;br /&gt;
$session = &amp;amp; JFactory::getSession();&lt;br /&gt;
		&lt;br /&gt;
$swfUploadHeadJs =&#039;&lt;br /&gt;
var swfu;&lt;br /&gt;
&lt;br /&gt;
window.onload = function()&lt;br /&gt;
{&lt;br /&gt;
			&lt;br /&gt;
var settings = &lt;br /&gt;
{&lt;br /&gt;
        //this is the path to the flash file, you need to put your components name into it&lt;br /&gt;
	flash_url : &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.swf&amp;quot;,&lt;br /&gt;
	&lt;br /&gt;
        //we can not put any vars into the url for complicated reasons, but we can put them into the post...&lt;br /&gt;
        upload_url: &amp;quot;index.php&amp;quot;,&lt;br /&gt;
	post_params: &lt;br /&gt;
	{&lt;br /&gt;
		&amp;quot;option&amp;quot; : &amp;quot;com_mycomponent&amp;quot;,&lt;br /&gt;
		&amp;quot;controller&amp;quot; : &amp;quot;mycontroller&amp;quot;,&lt;br /&gt;
		&amp;quot;task&amp;quot; : &amp;quot;mytask&amp;quot;,&lt;br /&gt;
		&amp;quot;id&amp;quot; : &amp;quot;&#039;.$myItemObject-&amp;gt;id.&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;&#039;.$session-&amp;gt;getName().&#039;&amp;quot; : &amp;quot;&#039;.$session-&amp;gt;getId().&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;format&amp;quot; : &amp;quot;raw&amp;quot;&lt;br /&gt;
	}, &lt;br /&gt;
        //you need to put the session and the &amp;quot;format raw&amp;quot; in there, the other ones are what you would normally put in the url&lt;br /&gt;
	file_size_limit : &amp;quot;5 MB&amp;quot;,&lt;br /&gt;
        //client side file chacking is for usability only, you need to check server side for security&lt;br /&gt;
	file_types : &amp;quot;*.jpg;*.jpeg;*.gif;*.png&amp;quot;,&lt;br /&gt;
	file_types_description : &amp;quot;All Files&amp;quot;,&lt;br /&gt;
	file_upload_limit : 100,&lt;br /&gt;
	file_queue_limit : 100,&lt;br /&gt;
	custom_settings : &lt;br /&gt;
	{&lt;br /&gt;
		progressTarget : &amp;quot;fsUploadProgress&amp;quot;,&lt;br /&gt;
		cancelButtonId : &amp;quot;btnCancel&amp;quot;&lt;br /&gt;
	},&lt;br /&gt;
	debug: false,&lt;br /&gt;
&lt;br /&gt;
	// Button settings&lt;br /&gt;
	button_image_url: &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/images/TestImageNoText_65x29.png&amp;quot;,&lt;br /&gt;
	button_width: &amp;quot;85&amp;quot;,&lt;br /&gt;
	button_height: &amp;quot;29&amp;quot;,&lt;br /&gt;
	button_placeholder_id: &amp;quot;spanButtonPlaceHolder&amp;quot;,&lt;br /&gt;
	button_text: \&#039;&amp;lt;span class=&amp;quot;theFont&amp;quot;&amp;gt;Choose Files&amp;lt;/span&amp;gt;\&#039;,&lt;br /&gt;
	button_text_style: &amp;quot;.theFont { font-size: 13; }&amp;quot;,&lt;br /&gt;
	button_text_left_padding: 5,&lt;br /&gt;
	button_text_top_padding: 5,&lt;br /&gt;
				&lt;br /&gt;
	// The event handler functions are defined in handlers.js&lt;br /&gt;
	file_queued_handler : fileQueued,&lt;br /&gt;
	file_queue_error_handler : fileQueueError,&lt;br /&gt;
	file_dialog_complete_handler : fileDialogComplete,&lt;br /&gt;
	upload_start_handler : uploadStart,&lt;br /&gt;
	upload_progress_handler : uploadProgress,&lt;br /&gt;
	upload_error_handler : uploadError,&lt;br /&gt;
	upload_success_handler : uploadSuccess,&lt;br /&gt;
	upload_complete_handler : uploadComplete,&lt;br /&gt;
	queue_complete_handler : queueComplete	// Queue plugin event&lt;br /&gt;
};&lt;br /&gt;
swfu = new SWFUpload(settings);&lt;br /&gt;
};&lt;br /&gt;
	     &lt;br /&gt;
&#039;;&lt;br /&gt;
&lt;br /&gt;
//add the javascript to the head of the html document&lt;br /&gt;
$document-&amp;gt;addScriptDeclaration($swfUploadHeadJs);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want more info on what each paramater is, have a look at the swfupload docs:&lt;br /&gt;
http://demo.swfupload.org/Documentation/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 4: Adding The Body HTML ===&lt;br /&gt;
&lt;br /&gt;
We still have to add in our body HTML, in you tmpl/default.php file add in:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;swfuploader&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;form id=&amp;quot;form1&amp;quot; action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; enctype=&amp;quot;multipart/form-data&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
			&amp;lt;div class=&amp;quot;fieldset flash&amp;quot; id=&amp;quot;fsUploadProgress&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;span class=&amp;quot;legend&amp;quot;&amp;gt;Upload Queue&amp;lt;/span&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div id=&amp;quot;divStatus&amp;quot;&amp;gt;0 Files Uploaded&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;div&amp;gt;&lt;br /&gt;
				&amp;lt;span id=&amp;quot;spanButtonPlaceHolder&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
				&amp;lt;input id=&amp;quot;btnCancel&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Cancel All Uploads&amp;quot; onclick=&amp;quot;swfu.cancelQueue();&amp;quot; disabled=&amp;quot;disabled&amp;quot; style=&amp;quot;margin-left: 2px; font-size: 8pt; height: 29px;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
	&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all has gone well, you will be able to upload files to your components script, although nothing will happen on the server as there is no PHP to recieve the image.&lt;br /&gt;
&lt;br /&gt;
===  Part 5: Recieveing The File With PHP ===&lt;br /&gt;
&lt;br /&gt;
It is worth noting that allowing users to upload files to the server is possibly the most dangerous thing to do in terms of security, and if someone with malicious intentions manages to upload a php file to your server, then they can easily take control of the site.&lt;br /&gt;
&lt;br /&gt;
It is recommeneded you do some reading on file upload security. This is a good start:&lt;br /&gt;
&lt;br /&gt;
http://www.scanit.be/uploads/php-file-upload.pdf&lt;br /&gt;
&lt;br /&gt;
And there are many other good resources on the internet. It is important you understand how file upload security works, rather than copying and pasting some code that checks the MIME type, and assuming the script is safe.&lt;br /&gt;
&lt;br /&gt;
Here is some example PHP that will check if the file is an image, and upload it. It is not an exhaustive example of security checking, but it is a good start:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//import joomlas filesystem functions, we will do all the filewriting with joomlas functions,&lt;br /&gt;
//so if the ftp layer is on, joomla will write with that, not the apache user, which might&lt;br /&gt;
//not have the correct permissions&lt;br /&gt;
jimport(&#039;joomla.filesystem.file&#039;);&lt;br /&gt;
jimport(&#039;joomla.filesystem.folder&#039;);&lt;br /&gt;
		&lt;br /&gt;
//this is the name of the field in the html form, filedata is the default name for swfupload&lt;br /&gt;
//so we will leave it as that&lt;br /&gt;
$fieldName = &#039;Filedata&#039;;&lt;br /&gt;
&lt;br /&gt;
//any errors the server registered on uploading&lt;br /&gt;
$fileError = $_FILES[$fieldName][&#039;error&#039;];&lt;br /&gt;
if ($fileError &amp;gt; 0) &lt;br /&gt;
{&lt;br /&gt;
        switch ($fileError) &lt;br /&gt;
	{&lt;br /&gt;
        case 1:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN PHP INI ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 2:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN HTML FORM ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 3:&lt;br /&gt;
        echo JText::_( &#039;ERROR PARTIAL UPLOAD&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 4:&lt;br /&gt;
        echo JText::_( &#039;ERROR NO FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check for filesize&lt;br /&gt;
$fileSize = $_FILES[$fieldName][&#039;size&#039;];&lt;br /&gt;
if($fileSize &amp;gt; 2000000)&lt;br /&gt;
{&lt;br /&gt;
    echo JText::_( &#039;FILE BIGGER THAN 2MB&#039; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check the file extension is ok&lt;br /&gt;
$fileName = $_FILES[$fieldName][&#039;name&#039;];&lt;br /&gt;
$uploadedFileNameParts = explode(&#039;.&#039;,$fileName);&lt;br /&gt;
$uploadedFileExtension = array_pop($uploadedFileNameParts);&lt;br /&gt;
&lt;br /&gt;
$validFileExts = explode(&#039;,&#039;, &#039;jpeg,jpg,png,gif&#039;);&lt;br /&gt;
&lt;br /&gt;
//assume the extension is false until we know its ok&lt;br /&gt;
$extOk = false;&lt;br /&gt;
&lt;br /&gt;
//go through every ok extension, if the ok extension matches the file extension (case insensitive)&lt;br /&gt;
//then the file extension is ok&lt;br /&gt;
foreach($validFileExts as $key =&amp;gt; $value)&lt;br /&gt;
{&lt;br /&gt;
	if( preg_match(&amp;quot;/$value/i&amp;quot;, $uploadedFileExtension ) )&lt;br /&gt;
	{&lt;br /&gt;
		$extOk = true;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ($extOk == false) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID EXTENSION&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
//the name of the file in PHP&#039;s temp directory that we are going to move to our folder&lt;br /&gt;
$fileTemp = $_FILES[$fieldName][&#039;tmp_name&#039;];&lt;br /&gt;
		&lt;br /&gt;
//for security purposes, we will also do a getimagesize on the temp file (before we have moved it &lt;br /&gt;
//to the folder) to check the MIME type of the file, and whether it has a width and height&lt;br /&gt;
$imageinfo = getimagesize($fileTemp);&lt;br /&gt;
		&lt;br /&gt;
//we are going to define what file extensions/MIMEs are ok, and only let these ones in (whitelisting), rather than try to scan for bad&lt;br /&gt;
//types, where we might miss one (whitelisting is always better than blacklisting) &lt;br /&gt;
$okMIMETypes = &#039;image/jpeg,image/pjpeg,image/png,image/x-png,image/gif&#039;;&lt;br /&gt;
$validFileTypes = explode(&amp;quot;,&amp;quot;, $okMIMETypes);		&lt;br /&gt;
&lt;br /&gt;
//if the temp file does not have a width or a height, or it has a non ok MIME, return&lt;br /&gt;
if( !is_int($imageinfo[0]) || !is_int($imageinfo[1]) ||  !in_array($imageinfo[&#039;mime&#039;], $validFileTypes) )&lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID FILETYPE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//lose any special characters in the filename&lt;br /&gt;
$fileName = ereg_replace(&amp;quot;[^A-Za-z0-9.]&amp;quot;, &amp;quot;-&amp;quot;, $fileName);&lt;br /&gt;
&lt;br /&gt;
//always use constants when making file paths, to avoid the possibilty of remote file inclusion&lt;br /&gt;
$uploadPath = JPATH_SITE.DS.&#039;images&#039;.DS.&#039;stories&#039;.DS.$fileName;&lt;br /&gt;
&lt;br /&gt;
if(!JFile::upload($fileTemp, $uploadPath)) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;ERROR MOVING FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
   // success, exit with code 0 for Mac users, otherwise they receive an IO Error&lt;br /&gt;
   exit(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all want well the uploaded files will be in the images/stories folder.&lt;br /&gt;
&lt;br /&gt;
===  Part 6: Flash plugin COOKIE bug on non-IE browsers ===&lt;br /&gt;
&lt;br /&gt;
Also you should pay attention to Flash player cookie bug!&lt;br /&gt;
&lt;br /&gt;
It is described here http://swfupload.org/forum/generaldiscussion/383&lt;br /&gt;
&lt;br /&gt;
The Flash Player Plugin for FireFox, Opera and Safari (and probably other non-IE based browsers) has a bug which sends persistent cookies from IE to the upload URL instead of the cookies from the browser. Session only cookies from IE are not sent.&lt;br /&gt;
&lt;br /&gt;
1) Any cookies from a non-IE browser (ie, authentication, login, etc) will not be sent with the file upload. Rather the cookies from IE will be sent. So, no cookies or the wrong cookies will be sent. In most cases this means sessions and cookie based authentication are lost when making an upload.&lt;br /&gt;
&lt;br /&gt;
2) Cookies set by the upload script do get set, but only for Flash. The browser will not see them.&lt;br /&gt;
&lt;br /&gt;
3) This bug affects Flash 8 and Flash 9 and all versions of SWFUpload&lt;br /&gt;
&lt;br /&gt;
4) You cannot rely on cookies when using SWFUpload (or any Flash based upload tool). You must send the data you need from the cookies in another way. There are several threads regarding this issue in the forum and many of the demos show workarounds for restoring PHP sessions and some sample files show how to restore the cookies so Session and Authentication are restored in ASP.Net.&lt;br /&gt;
&lt;br /&gt;
5) This could be considered a security issue but probably not severe enough to actually compromise any data. The cookies created in IE by Flash still have all the rules and restricts associated with cookies in any browser.&lt;br /&gt;
&lt;br /&gt;
Solution is modify function _start() (libraries\joomla\session\session.php):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$sn = session_name();&lt;br /&gt;
&lt;br /&gt;
if(isset($_COOKIE[$sn]) &amp;amp;&amp;amp; isset($_POST[$sn])) &lt;br /&gt;
   {&lt;br /&gt;
	$_COOKIE[$sn] = $_POST[$sn];&lt;br /&gt;
	session_id($_POST[$sn]);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
session_start();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=16022</id>
		<title>Portal:Developers</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=16022"/>
		<updated>2009-10-21T03:57:52Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Security */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer profile}}&lt;br /&gt;
&lt;br /&gt;
A complete contents list of all pages of interest to developers can be found in the [[:Category:Development|development category]].&lt;br /&gt;
&lt;br /&gt;
== Reference Material ==&lt;br /&gt;
&lt;br /&gt;
* [[Framework|Joomla Framework]].&lt;br /&gt;
* [http://api.joomla.org API documentation] automatically generated using phpDocumentor.&lt;br /&gt;
&lt;br /&gt;
== Articles and Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [[Setting up your workstation for extension development]] A guide to Joomla Extension development&lt;br /&gt;
* [http://community.joomla.org/blogs/community/828-webinar-using-eclipse-for-joomla-development.html Using Eclipse for Joomla! Development] Video webinar demonstrating overview of Eclipse features for Joomla! development&lt;br /&gt;
* [[Do not use die to debug]]&lt;br /&gt;
* [[How to debug your code]]&lt;br /&gt;
* [[Tutorial:Adapting Joomla 1.0 extensions to Joomla 1.5]]&lt;br /&gt;
* [[Version 1.6 Developer Notes]]&lt;br /&gt;
* [[Tutorial:Joomla Beginning Developer Course]]&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
* Developing a Model-View-Controller (MVC) Component&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
* [[File Structure and Naming Conventions]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Components:xml installfile]].  An example component XML installation file.&lt;br /&gt;
* [[How to use the JPane classes in a component]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Adding Javascript moo.fx to your component WIP]]&lt;br /&gt;
* [[Creating a toolbar for your component]]&lt;br /&gt;
* [[Adding view layout configuration parameters]]&lt;br /&gt;
* [[How to implement XML-RPC in a component]]&lt;br /&gt;
* [[Using JPagination in your component]]&lt;br /&gt;
* [[Adding sortable columns to a table in a component]]&lt;br /&gt;
* [[Using multiple models in an MVC component]]&lt;br /&gt;
* [[Ajax using MooTools]]&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
* [[Tutorial:Creating a Hello World Module for Joomla_1.5]]&lt;br /&gt;
* [[How to create a module]]&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* [[Plugin Developer Overview]]&lt;br /&gt;
* [[Tutorial:Plugins]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/184-how-to-create-a-joomla-plugin.html How to create a Joomla! Plugin]&lt;br /&gt;
* [[How to create a content plugin]]&lt;br /&gt;
* [[How to create a search plugin]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Creating an Authentication Plugin for Joomla 1.5]]&lt;br /&gt;
* [[Tutorial:Using plugins in your own extension]]&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
* [[Understanding Output Overrides]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/165-understanding-output-overrides-in-joomla.html Understanding Output Overrides in Joomla! 1.5]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
* [[How are templates executed?]]&lt;br /&gt;
* [[How to determine if the user is viewing the front page]]&lt;br /&gt;
* [[Tutorial:Template parameters]]&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* [[Standard parameter types]]&lt;br /&gt;
* [[Custom parameter types]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
See also: [[:Category:Parameters]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* [[How to add CSRF anti-spoofing to forms]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/181-preventing-sql-injections.html Preventing SQL Injections]&lt;br /&gt;
* [[Tutorial:How_to_make_your_Joomla_addon_more_secure_WIP]]&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
* [[How to use the database classes in your script]]&lt;br /&gt;
* [[How to use the JTable class]]&lt;br /&gt;
* [[How to connect to an external database]]&lt;br /&gt;
&lt;br /&gt;
=== Localisation ===&lt;br /&gt;
* [http://community.joomla.org/magazine/article/508-developer-localization-advancements-in-joomla-15.html Localization Advancements in Joomla! 1.5]&lt;br /&gt;
* [[Adding multi-language support]]&lt;br /&gt;
* [[Adding Joomfish functionality to custom components]]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[How to use the filesystem package]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Adding AJAX to your component]].&lt;br /&gt;
* [[How to send email from components]]&lt;br /&gt;
* [[How to use the JToolBar class in the frontend]]&lt;br /&gt;
* [[Routing]]&lt;br /&gt;
* [[Joomla Routes and SEF]]&lt;br /&gt;
* [[API Execution Order]]&lt;br /&gt;
* [[Accessing the current user object]]&lt;br /&gt;
* [[Adding JavaScript and CSS to the page]]&lt;br /&gt;
* [[Constants]] used in the Joomla [[Framework]].&lt;br /&gt;
* [[Form validation]]&lt;br /&gt;
* [[How to create a custom button]]&lt;br /&gt;
* [[How to create a stand-alone application using the Joomla! Framework]]&lt;br /&gt;
* [[How to use user state variables]]&lt;br /&gt;
* [[Adding template overridable images in your extension]]&lt;br /&gt;
* [[Retrieving data from GET and POST requests]]&lt;br /&gt;
* [[Using caching to speed up your code]]&lt;br /&gt;
* [[Using a custom image in the menu bar title]]&lt;br /&gt;
* [[Using the installer API to support package installation]]&lt;br /&gt;
* [[Tutorial:How to add tooltips to your Joomla! website]]&lt;br /&gt;
* [[Xml-rpc|XML-RPC]]&lt;br /&gt;
* [[How to add breadcrumbs]]&lt;br /&gt;
* [[Creating a file uploader in your component]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Development ==&lt;br /&gt;
The development of Joomla itself is carried out by the [[Development Working Group]] and third party developers.&lt;br /&gt;
&lt;br /&gt;
* [[Participating in the community]]: a brief description of how people can get involved.&lt;br /&gt;
* [[Developer Email lists]]: a list of email lists for developers, including third party developers.&lt;br /&gt;
* [[Coding style and standards]] (To be reviewed).&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development_--_Part_2#Check_Out_Joomla.21_Source_Code How to check out SVN Code]&lt;br /&gt;
* [[Patch submission guidelines]].&lt;br /&gt;
* [[Filing bugs and issues]].&lt;br /&gt;
* [[How to release a distribution tarball]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Developer Documentation ==&lt;br /&gt;
The development of Joomla developer documentation is carried out primarily by the [[Documentation Working Group]].  There are currently two sub-projects of interest to developers:&lt;br /&gt;
* [[Joomla! 1.5 Template Tutorials Project]]&lt;br /&gt;
* [[API Reference Project]]&lt;br /&gt;
&lt;br /&gt;
When creating a new page, ensure you place the following marker at the bottom of the page so it is included in the category list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Development]]&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you locate other articles you think are relevant to developers, please add this marker to those pages.&lt;br /&gt;
&lt;br /&gt;
=== Suggested topics ===&lt;br /&gt;
This is a short list of articles that might be written to support developers.  Please feel free to add further topic ideas.&lt;br /&gt;
&lt;br /&gt;
* [[Adding configuration objects to modules and plugins]].&lt;br /&gt;
* [[Storing data in the session between page loads]].&lt;br /&gt;
* [[Suppressing output of extra HTML]].&lt;br /&gt;
* [[How to use the filter package]].&lt;br /&gt;
*: Describe how and when to use the Filter package and explain what needs to be filtered for various situations (for queries, for URLs, etc)&lt;br /&gt;
* [[How to use the registry package]]&lt;br /&gt;
* [[How to use JSimpleXML]].&lt;br /&gt;
*: How to load and store XML files and how to work with them&lt;br /&gt;
* [[How to create component feeds]] (RSS/ATOM)&lt;br /&gt;
* [[How to create PDF views]]&lt;br /&gt;
* [[How to generate paths for client side and server side]]&lt;br /&gt;
* [[How to access information from the request]]&lt;br /&gt;
*: This focuses on using the JBrowser class to retrieve information about the features available in the user&#039;s browser.&lt;br /&gt;
* [[How to create an editor plugin]]&lt;br /&gt;
* [[What can be done with a user plugin]]&lt;br /&gt;
* [[How to work with parameters]]&lt;br /&gt;
* [[How to cloak email addresses]]&lt;br /&gt;
* [[Using the caching system in your component]].&lt;br /&gt;
&lt;br /&gt;
==Joomla Security Guide==&lt;br /&gt;
Developers should also be aware of security issues.&lt;br /&gt;
{{Security Guide}}&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15793</id>
		<title>Portal:Developers</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15793"/>
		<updated>2009-09-29T23:54:57Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Miscellaneous */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer profile}}&lt;br /&gt;
&lt;br /&gt;
A complete contents list of all pages of interest to developers can be found in the [[:Category:Development|development category]].&lt;br /&gt;
&lt;br /&gt;
== Reference Material ==&lt;br /&gt;
&lt;br /&gt;
* [[Framework|Joomla Framework]].&lt;br /&gt;
* [http://api.joomla.org API documentation] automatically generated using phpDocumentor.&lt;br /&gt;
&lt;br /&gt;
== Articles and Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [[Setting up your workstation for extension development]] A guide to Joomla Extension development&lt;br /&gt;
* [http://community.joomla.org/blogs/community/828-webinar-using-eclipse-for-joomla-development.html Using Eclipse for Joomla! Development] Video webinar demonstrating overview of Eclipse features for Joomla! development&lt;br /&gt;
* [[Do not use die to debug]]&lt;br /&gt;
* [[How to debug your code]]&lt;br /&gt;
* [[Tutorial:Adapting Joomla 1.0 extensions to Joomla 1.5]]&lt;br /&gt;
* [[Version 1.6 Developer Notes]]&lt;br /&gt;
* [[Tutorial:Joomla Beginning Developer Course]]&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
* Developing a Model-View-Controller (MVC) Component&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
* [[File Structure and Naming Conventions]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Components:xml installfile]].  An example component XML installation file.&lt;br /&gt;
* [[How to use the JPane classes in a component]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Adding Javascript moo.fx to your component WIP]]&lt;br /&gt;
* [[Creating a toolbar for your component]]&lt;br /&gt;
* [[Adding view layout configuration parameters]]&lt;br /&gt;
* [[How to implement XML-RPC in a component]]&lt;br /&gt;
* [[Using JPagination in your component]]&lt;br /&gt;
* [[Adding sortable columns to a table in a component]]&lt;br /&gt;
* [[Using multiple models in an MVC component]]&lt;br /&gt;
* [[Ajax using MooTools]]&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
* [[Tutorial:Creating a Hello World Module for Joomla_1.5]]&lt;br /&gt;
* [[How to create a module]]&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* [[Plugin Developer Overview]]&lt;br /&gt;
* [[Tutorial:Plugins]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/184-how-to-create-a-joomla-plugin.html How to create a Joomla! Plugin]&lt;br /&gt;
* [[How to create a content plugin]]&lt;br /&gt;
* [[How to create a search plugin]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Creating an Authentication Plugin for Joomla 1.5]]&lt;br /&gt;
* [[Tutorial:Using plugins in your own extension]]&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
* [[Understanding Output Overrides]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/165-understanding-output-overrides-in-joomla.html Understanding Output Overrides in Joomla! 1.5]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
* [[How are templates executed?]]&lt;br /&gt;
* [[How to determine if the user is viewing the front page]]&lt;br /&gt;
* [[Tutorial:Template parameters]]&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* [[Standard parameter types]]&lt;br /&gt;
* [[Custom parameter types]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
See also: [[:Category:Parameters]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* [[How to add CSRF anti-spoofing to forms]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/181-preventing-sql-injections.html Preventing SQL Injections]&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
* [[How to use the database classes in your script]]&lt;br /&gt;
* [[How to use the JTable class]]&lt;br /&gt;
* [[How to connect to an external database]]&lt;br /&gt;
&lt;br /&gt;
=== Localisation ===&lt;br /&gt;
* [http://community.joomla.org/magazine/article/508-developer-localization-advancements-in-joomla-15.html Localization Advancements in Joomla! 1.5]&lt;br /&gt;
* [[Adding multi-language support]]&lt;br /&gt;
* [[Adding Joomfish functionality to custom components]]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[How to use the filesystem package]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Adding AJAX to your component]].&lt;br /&gt;
* [[How to send email from components]]&lt;br /&gt;
* [[How to use the JToolBar class in the frontend]]&lt;br /&gt;
* [[Routing]]&lt;br /&gt;
* [[Joomla Routes and SEF]]&lt;br /&gt;
* [[API Execution Order]]&lt;br /&gt;
* [[Accessing the current user object]]&lt;br /&gt;
* [[Adding JavaScript and CSS to the page]]&lt;br /&gt;
* [[Constants]] used in the Joomla [[Framework]].&lt;br /&gt;
* [[Form validation]]&lt;br /&gt;
* [[How to create a custom button]]&lt;br /&gt;
* [[How to create a stand-alone application using the Joomla! Framework]]&lt;br /&gt;
* [[How to use user state variables]]&lt;br /&gt;
* [[Adding template overridable images in your extension]]&lt;br /&gt;
* [[Retrieving data from GET and POST requests]]&lt;br /&gt;
* [[Using caching to speed up your code]]&lt;br /&gt;
* [[Using a custom image in the menu bar title]]&lt;br /&gt;
* [[Using the installer API to support package installation]]&lt;br /&gt;
* [[Tutorial:How to add tooltips to your Joomla! website]]&lt;br /&gt;
* [[Xml-rpc|XML-RPC]]&lt;br /&gt;
* [[How to add breadcrumbs]]&lt;br /&gt;
* [[Creating a file uploader in your component]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Development ==&lt;br /&gt;
The development of Joomla itself is carried out by the [[Development Working Group]] and third party developers.&lt;br /&gt;
&lt;br /&gt;
* [[Participating in the community]]: a brief description of how people can get involved.&lt;br /&gt;
* [[Developer Email lists]]: a list of email lists for developers, including third party developers.&lt;br /&gt;
* [[Coding style and standards]] (To be reviewed).&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development_--_Part_2#Check_Out_Joomla.21_Source_Code How to check out SVN Code]&lt;br /&gt;
* [[Patch submission guidelines]].&lt;br /&gt;
* [[Filing bugs and issues]].&lt;br /&gt;
* [[How to release a distribution tarball]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Developer Documentation ==&lt;br /&gt;
The development of Joomla developer documentation is carried out primarily by the [[Documentation Working Group]].  There are currently two sub-projects of interest to developers:&lt;br /&gt;
* [[Joomla! 1.5 Template Tutorials Project]]&lt;br /&gt;
* [[API Reference Project]]&lt;br /&gt;
&lt;br /&gt;
When creating a new page, ensure you place the following marker at the bottom of the page so it is included in the category list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Development]]&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you locate other articles you think are relevant to developers, please add this marker to those pages.&lt;br /&gt;
&lt;br /&gt;
=== Suggested topics ===&lt;br /&gt;
This is a short list of articles that might be written to support developers.  Please feel free to add further topic ideas.&lt;br /&gt;
&lt;br /&gt;
* [[Adding configuration objects to modules and plugins]].&lt;br /&gt;
* [[Storing data in the session between page loads]].&lt;br /&gt;
* [[Suppressing output of extra HTML]].&lt;br /&gt;
* [[How to use the filter package]].&lt;br /&gt;
*: Describe how and when to use the Filter package and explain what needs to be filtered for various situations (for queries, for URLs, etc)&lt;br /&gt;
* [[How to use the registry package]]&lt;br /&gt;
* [[How to use JSimpleXML]].&lt;br /&gt;
*: How to load and store XML files and how to work with them&lt;br /&gt;
* [[How to create component feeds]] (RSS/ATOM)&lt;br /&gt;
* [[How to create PDF views]]&lt;br /&gt;
* [[How to generate paths for client side and server side]]&lt;br /&gt;
* [[How to access information from the request]]&lt;br /&gt;
*: This focuses on using the JBrowser class to retrieve information about the features available in the user&#039;s browser.&lt;br /&gt;
* [[How to create an editor plugin]]&lt;br /&gt;
* [[What can be done with a user plugin]]&lt;br /&gt;
* [[How to work with parameters]]&lt;br /&gt;
* [[How to cloak email addresses]]&lt;br /&gt;
* [[Using the caching system in your component]].&lt;br /&gt;
&lt;br /&gt;
==Joomla Security Guide==&lt;br /&gt;
Developers should also be aware of security issues.&lt;br /&gt;
{{Security Guide}}&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15792</id>
		<title>Portal:Developers</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15792"/>
		<updated>2009-09-29T23:54:39Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Contributing to Joomla Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer profile}}&lt;br /&gt;
&lt;br /&gt;
A complete contents list of all pages of interest to developers can be found in the [[:Category:Development|development category]].&lt;br /&gt;
&lt;br /&gt;
== Reference Material ==&lt;br /&gt;
&lt;br /&gt;
* [[Framework|Joomla Framework]].&lt;br /&gt;
* [http://api.joomla.org API documentation] automatically generated using phpDocumentor.&lt;br /&gt;
&lt;br /&gt;
== Articles and Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [[Setting up your workstation for extension development]] A guide to Joomla Extension development&lt;br /&gt;
* [http://community.joomla.org/blogs/community/828-webinar-using-eclipse-for-joomla-development.html Using Eclipse for Joomla! Development] Video webinar demonstrating overview of Eclipse features for Joomla! development&lt;br /&gt;
* [[Do not use die to debug]]&lt;br /&gt;
* [[How to debug your code]]&lt;br /&gt;
* [[Tutorial:Adapting Joomla 1.0 extensions to Joomla 1.5]]&lt;br /&gt;
* [[Version 1.6 Developer Notes]]&lt;br /&gt;
* [[Tutorial:Joomla Beginning Developer Course]]&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
* Developing a Model-View-Controller (MVC) Component&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
* [[File Structure and Naming Conventions]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Components:xml installfile]].  An example component XML installation file.&lt;br /&gt;
* [[How to use the JPane classes in a component]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Adding Javascript moo.fx to your component WIP]]&lt;br /&gt;
* [[Creating a toolbar for your component]]&lt;br /&gt;
* [[Adding view layout configuration parameters]]&lt;br /&gt;
* [[How to implement XML-RPC in a component]]&lt;br /&gt;
* [[Using JPagination in your component]]&lt;br /&gt;
* [[Adding sortable columns to a table in a component]]&lt;br /&gt;
* [[Using multiple models in an MVC component]]&lt;br /&gt;
* [[Ajax using MooTools]]&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
* [[Tutorial:Creating a Hello World Module for Joomla_1.5]]&lt;br /&gt;
* [[How to create a module]]&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* [[Plugin Developer Overview]]&lt;br /&gt;
* [[Tutorial:Plugins]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/184-how-to-create-a-joomla-plugin.html How to create a Joomla! Plugin]&lt;br /&gt;
* [[How to create a content plugin]]&lt;br /&gt;
* [[How to create a search plugin]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Creating an Authentication Plugin for Joomla 1.5]]&lt;br /&gt;
* [[Tutorial:Using plugins in your own extension]]&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
* [[Understanding Output Overrides]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/165-understanding-output-overrides-in-joomla.html Understanding Output Overrides in Joomla! 1.5]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
* [[How are templates executed?]]&lt;br /&gt;
* [[How to determine if the user is viewing the front page]]&lt;br /&gt;
* [[Tutorial:Template parameters]]&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* [[Standard parameter types]]&lt;br /&gt;
* [[Custom parameter types]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
See also: [[:Category:Parameters]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* [[How to add CSRF anti-spoofing to forms]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/181-preventing-sql-injections.html Preventing SQL Injections]&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
* [[How to use the database classes in your script]]&lt;br /&gt;
* [[How to use the JTable class]]&lt;br /&gt;
* [[How to connect to an external database]]&lt;br /&gt;
&lt;br /&gt;
=== Localisation ===&lt;br /&gt;
* [http://community.joomla.org/magazine/article/508-developer-localization-advancements-in-joomla-15.html Localization Advancements in Joomla! 1.5]&lt;br /&gt;
* [[Adding multi-language support]]&lt;br /&gt;
* [[Adding Joomfish functionality to custom components]]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[How to use the filesystem package]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Adding AJAX to your component]].&lt;br /&gt;
* [[How to send email from components]]&lt;br /&gt;
* [[How to use the JToolBar class in the frontend]]&lt;br /&gt;
* [[Routing]]&lt;br /&gt;
* [[Joomla Routes and SEF]]&lt;br /&gt;
* [[API Execution Order]]&lt;br /&gt;
* [[Accessing the current user object]]&lt;br /&gt;
* [[Adding JavaScript and CSS to the page]]&lt;br /&gt;
* [[Constants]] used in the Joomla [[Framework]].&lt;br /&gt;
* [[Form validation]]&lt;br /&gt;
* [[How to create a custom button]]&lt;br /&gt;
* [[How to create a stand-alone application using the Joomla! Framework]]&lt;br /&gt;
* [[How to use user state variables]]&lt;br /&gt;
* [[Adding template overridable images in your extension]]&lt;br /&gt;
* [[Retrieving data from GET and POST requests]]&lt;br /&gt;
* [[Using caching to speed up your code]]&lt;br /&gt;
* [[Using a custom image in the menu bar title]]&lt;br /&gt;
* [[Using the installer API to support package installation]]&lt;br /&gt;
* [[Tutorial:How to add tooltips to your Joomla! website]]&lt;br /&gt;
* [[Xml-rpc|XML-RPC]]&lt;br /&gt;
* [[How to add breadcrumbs]]&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Development ==&lt;br /&gt;
The development of Joomla itself is carried out by the [[Development Working Group]] and third party developers.&lt;br /&gt;
&lt;br /&gt;
* [[Participating in the community]]: a brief description of how people can get involved.&lt;br /&gt;
* [[Developer Email lists]]: a list of email lists for developers, including third party developers.&lt;br /&gt;
* [[Coding style and standards]] (To be reviewed).&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development_--_Part_2#Check_Out_Joomla.21_Source_Code How to check out SVN Code]&lt;br /&gt;
* [[Patch submission guidelines]].&lt;br /&gt;
* [[Filing bugs and issues]].&lt;br /&gt;
* [[How to release a distribution tarball]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Developer Documentation ==&lt;br /&gt;
The development of Joomla developer documentation is carried out primarily by the [[Documentation Working Group]].  There are currently two sub-projects of interest to developers:&lt;br /&gt;
* [[Joomla! 1.5 Template Tutorials Project]]&lt;br /&gt;
* [[API Reference Project]]&lt;br /&gt;
&lt;br /&gt;
When creating a new page, ensure you place the following marker at the bottom of the page so it is included in the category list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Development]]&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you locate other articles you think are relevant to developers, please add this marker to those pages.&lt;br /&gt;
&lt;br /&gt;
=== Suggested topics ===&lt;br /&gt;
This is a short list of articles that might be written to support developers.  Please feel free to add further topic ideas.&lt;br /&gt;
&lt;br /&gt;
* [[Adding configuration objects to modules and plugins]].&lt;br /&gt;
* [[Storing data in the session between page loads]].&lt;br /&gt;
* [[Suppressing output of extra HTML]].&lt;br /&gt;
* [[How to use the filter package]].&lt;br /&gt;
*: Describe how and when to use the Filter package and explain what needs to be filtered for various situations (for queries, for URLs, etc)&lt;br /&gt;
* [[How to use the registry package]]&lt;br /&gt;
* [[How to use JSimpleXML]].&lt;br /&gt;
*: How to load and store XML files and how to work with them&lt;br /&gt;
* [[How to create component feeds]] (RSS/ATOM)&lt;br /&gt;
* [[How to create PDF views]]&lt;br /&gt;
* [[How to generate paths for client side and server side]]&lt;br /&gt;
* [[How to access information from the request]]&lt;br /&gt;
*: This focuses on using the JBrowser class to retrieve information about the features available in the user&#039;s browser.&lt;br /&gt;
* [[How to create an editor plugin]]&lt;br /&gt;
* [[What can be done with a user plugin]]&lt;br /&gt;
* [[How to work with parameters]]&lt;br /&gt;
* [[How to cloak email addresses]]&lt;br /&gt;
* [[Using the caching system in your component]].&lt;br /&gt;
&lt;br /&gt;
==Joomla Security Guide==&lt;br /&gt;
Developers should also be aware of security issues.&lt;br /&gt;
{{Security Guide}}&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15791</id>
		<title>Portal:Developers</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15791"/>
		<updated>2009-09-29T23:54:13Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Contributing to Joomla Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer profile}}&lt;br /&gt;
&lt;br /&gt;
A complete contents list of all pages of interest to developers can be found in the [[:Category:Development|development category]].&lt;br /&gt;
&lt;br /&gt;
== Reference Material ==&lt;br /&gt;
&lt;br /&gt;
* [[Framework|Joomla Framework]].&lt;br /&gt;
* [http://api.joomla.org API documentation] automatically generated using phpDocumentor.&lt;br /&gt;
&lt;br /&gt;
== Articles and Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [[Setting up your workstation for extension development]] A guide to Joomla Extension development&lt;br /&gt;
* [http://community.joomla.org/blogs/community/828-webinar-using-eclipse-for-joomla-development.html Using Eclipse for Joomla! Development] Video webinar demonstrating overview of Eclipse features for Joomla! development&lt;br /&gt;
* [[Do not use die to debug]]&lt;br /&gt;
* [[How to debug your code]]&lt;br /&gt;
* [[Tutorial:Adapting Joomla 1.0 extensions to Joomla 1.5]]&lt;br /&gt;
* [[Version 1.6 Developer Notes]]&lt;br /&gt;
* [[Tutorial:Joomla Beginning Developer Course]]&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
* Developing a Model-View-Controller (MVC) Component&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
* [[File Structure and Naming Conventions]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Components:xml installfile]].  An example component XML installation file.&lt;br /&gt;
* [[How to use the JPane classes in a component]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Adding Javascript moo.fx to your component WIP]]&lt;br /&gt;
* [[Creating a toolbar for your component]]&lt;br /&gt;
* [[Adding view layout configuration parameters]]&lt;br /&gt;
* [[How to implement XML-RPC in a component]]&lt;br /&gt;
* [[Using JPagination in your component]]&lt;br /&gt;
* [[Adding sortable columns to a table in a component]]&lt;br /&gt;
* [[Using multiple models in an MVC component]]&lt;br /&gt;
* [[Ajax using MooTools]]&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
* [[Tutorial:Creating a Hello World Module for Joomla_1.5]]&lt;br /&gt;
* [[How to create a module]]&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* [[Plugin Developer Overview]]&lt;br /&gt;
* [[Tutorial:Plugins]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/184-how-to-create-a-joomla-plugin.html How to create a Joomla! Plugin]&lt;br /&gt;
* [[How to create a content plugin]]&lt;br /&gt;
* [[How to create a search plugin]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Creating an Authentication Plugin for Joomla 1.5]]&lt;br /&gt;
* [[Tutorial:Using plugins in your own extension]]&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
* [[Understanding Output Overrides]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/165-understanding-output-overrides-in-joomla.html Understanding Output Overrides in Joomla! 1.5]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
* [[How are templates executed?]]&lt;br /&gt;
* [[How to determine if the user is viewing the front page]]&lt;br /&gt;
* [[Tutorial:Template parameters]]&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* [[Standard parameter types]]&lt;br /&gt;
* [[Custom parameter types]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
See also: [[:Category:Parameters]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* [[How to add CSRF anti-spoofing to forms]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/181-preventing-sql-injections.html Preventing SQL Injections]&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
* [[How to use the database classes in your script]]&lt;br /&gt;
* [[How to use the JTable class]]&lt;br /&gt;
* [[How to connect to an external database]]&lt;br /&gt;
&lt;br /&gt;
=== Localisation ===&lt;br /&gt;
* [http://community.joomla.org/magazine/article/508-developer-localization-advancements-in-joomla-15.html Localization Advancements in Joomla! 1.5]&lt;br /&gt;
* [[Adding multi-language support]]&lt;br /&gt;
* [[Adding Joomfish functionality to custom components]]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[How to use the filesystem package]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Adding AJAX to your component]].&lt;br /&gt;
* [[How to send email from components]]&lt;br /&gt;
* [[How to use the JToolBar class in the frontend]]&lt;br /&gt;
* [[Routing]]&lt;br /&gt;
* [[Joomla Routes and SEF]]&lt;br /&gt;
* [[API Execution Order]]&lt;br /&gt;
* [[Accessing the current user object]]&lt;br /&gt;
* [[Adding JavaScript and CSS to the page]]&lt;br /&gt;
* [[Constants]] used in the Joomla [[Framework]].&lt;br /&gt;
* [[Form validation]]&lt;br /&gt;
* [[How to create a custom button]]&lt;br /&gt;
* [[How to create a stand-alone application using the Joomla! Framework]]&lt;br /&gt;
* [[How to use user state variables]]&lt;br /&gt;
* [[Adding template overridable images in your extension]]&lt;br /&gt;
* [[Retrieving data from GET and POST requests]]&lt;br /&gt;
* [[Using caching to speed up your code]]&lt;br /&gt;
* [[Using a custom image in the menu bar title]]&lt;br /&gt;
* [[Using the installer API to support package installation]]&lt;br /&gt;
* [[Tutorial:How to add tooltips to your Joomla! website]]&lt;br /&gt;
* [[Xml-rpc|XML-RPC]]&lt;br /&gt;
* [[How to add breadcrumbs]]&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Development ==&lt;br /&gt;
The development of Joomla itself is carried out by the [[Development Working Group]] and third party developers.&lt;br /&gt;
&lt;br /&gt;
* [[Participating in the community]]: a brief description of how people can get involved.&lt;br /&gt;
* [[Developer Email lists]]: a list of email lists for developers, including third party developers.&lt;br /&gt;
* [[Coding style and standards]] (To be reviewed).&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development_--_Part_2#Check_Out_Joomla.21_Source_Code How to check out SVN Code]&lt;br /&gt;
* [[Patch submission guidelines]].&lt;br /&gt;
* [[Filing bugs and issues]].&lt;br /&gt;
* [[How to release a distribution tarball]].&lt;br /&gt;
* [[Creating a file uploader in your component]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Developer Documentation ==&lt;br /&gt;
The development of Joomla developer documentation is carried out primarily by the [[Documentation Working Group]].  There are currently two sub-projects of interest to developers:&lt;br /&gt;
* [[Joomla! 1.5 Template Tutorials Project]]&lt;br /&gt;
* [[API Reference Project]]&lt;br /&gt;
&lt;br /&gt;
When creating a new page, ensure you place the following marker at the bottom of the page so it is included in the category list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Development]]&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you locate other articles you think are relevant to developers, please add this marker to those pages.&lt;br /&gt;
&lt;br /&gt;
=== Suggested topics ===&lt;br /&gt;
This is a short list of articles that might be written to support developers.  Please feel free to add further topic ideas.&lt;br /&gt;
&lt;br /&gt;
* [[Adding configuration objects to modules and plugins]].&lt;br /&gt;
* [[Storing data in the session between page loads]].&lt;br /&gt;
* [[Suppressing output of extra HTML]].&lt;br /&gt;
* [[How to use the filter package]].&lt;br /&gt;
*: Describe how and when to use the Filter package and explain what needs to be filtered for various situations (for queries, for URLs, etc)&lt;br /&gt;
* [[How to use the registry package]]&lt;br /&gt;
* [[How to use JSimpleXML]].&lt;br /&gt;
*: How to load and store XML files and how to work with them&lt;br /&gt;
* [[How to create component feeds]] (RSS/ATOM)&lt;br /&gt;
* [[How to create PDF views]]&lt;br /&gt;
* [[How to generate paths for client side and server side]]&lt;br /&gt;
* [[How to access information from the request]]&lt;br /&gt;
*: This focuses on using the JBrowser class to retrieve information about the features available in the user&#039;s browser.&lt;br /&gt;
* [[How to create an editor plugin]]&lt;br /&gt;
* [[What can be done with a user plugin]]&lt;br /&gt;
* [[How to work with parameters]]&lt;br /&gt;
* [[How to cloak email addresses]]&lt;br /&gt;
* [[Using the caching system in your component]].&lt;br /&gt;
&lt;br /&gt;
==Joomla Security Guide==&lt;br /&gt;
Developers should also be aware of security issues.&lt;br /&gt;
{{Security Guide}}&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15790</id>
		<title>Portal:Developers</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15790"/>
		<updated>2009-09-29T23:53:41Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Suggested topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer profile}}&lt;br /&gt;
&lt;br /&gt;
A complete contents list of all pages of interest to developers can be found in the [[:Category:Development|development category]].&lt;br /&gt;
&lt;br /&gt;
== Reference Material ==&lt;br /&gt;
&lt;br /&gt;
* [[Framework|Joomla Framework]].&lt;br /&gt;
* [http://api.joomla.org API documentation] automatically generated using phpDocumentor.&lt;br /&gt;
&lt;br /&gt;
== Articles and Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [[Setting up your workstation for extension development]] A guide to Joomla Extension development&lt;br /&gt;
* [http://community.joomla.org/blogs/community/828-webinar-using-eclipse-for-joomla-development.html Using Eclipse for Joomla! Development] Video webinar demonstrating overview of Eclipse features for Joomla! development&lt;br /&gt;
* [[Do not use die to debug]]&lt;br /&gt;
* [[How to debug your code]]&lt;br /&gt;
* [[Tutorial:Adapting Joomla 1.0 extensions to Joomla 1.5]]&lt;br /&gt;
* [[Version 1.6 Developer Notes]]&lt;br /&gt;
* [[Tutorial:Joomla Beginning Developer Course]]&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
* Developing a Model-View-Controller (MVC) Component&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
* [[File Structure and Naming Conventions]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Components:xml installfile]].  An example component XML installation file.&lt;br /&gt;
* [[How to use the JPane classes in a component]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Adding Javascript moo.fx to your component WIP]]&lt;br /&gt;
* [[Creating a toolbar for your component]]&lt;br /&gt;
* [[Adding view layout configuration parameters]]&lt;br /&gt;
* [[How to implement XML-RPC in a component]]&lt;br /&gt;
* [[Using JPagination in your component]]&lt;br /&gt;
* [[Adding sortable columns to a table in a component]]&lt;br /&gt;
* [[Using multiple models in an MVC component]]&lt;br /&gt;
* [[Ajax using MooTools]]&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
* [[Tutorial:Creating a Hello World Module for Joomla_1.5]]&lt;br /&gt;
* [[How to create a module]]&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* [[Plugin Developer Overview]]&lt;br /&gt;
* [[Tutorial:Plugins]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/184-how-to-create-a-joomla-plugin.html How to create a Joomla! Plugin]&lt;br /&gt;
* [[How to create a content plugin]]&lt;br /&gt;
* [[How to create a search plugin]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Creating an Authentication Plugin for Joomla 1.5]]&lt;br /&gt;
* [[Tutorial:Using plugins in your own extension]]&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
* [[Understanding Output Overrides]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/165-understanding-output-overrides-in-joomla.html Understanding Output Overrides in Joomla! 1.5]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
* [[How are templates executed?]]&lt;br /&gt;
* [[How to determine if the user is viewing the front page]]&lt;br /&gt;
* [[Tutorial:Template parameters]]&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* [[Standard parameter types]]&lt;br /&gt;
* [[Custom parameter types]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
See also: [[:Category:Parameters]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* [[How to add CSRF anti-spoofing to forms]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/181-preventing-sql-injections.html Preventing SQL Injections]&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
* [[How to use the database classes in your script]]&lt;br /&gt;
* [[How to use the JTable class]]&lt;br /&gt;
* [[How to connect to an external database]]&lt;br /&gt;
&lt;br /&gt;
=== Localisation ===&lt;br /&gt;
* [http://community.joomla.org/magazine/article/508-developer-localization-advancements-in-joomla-15.html Localization Advancements in Joomla! 1.5]&lt;br /&gt;
* [[Adding multi-language support]]&lt;br /&gt;
* [[Adding Joomfish functionality to custom components]]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[How to use the filesystem package]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Adding AJAX to your component]].&lt;br /&gt;
* [[How to send email from components]]&lt;br /&gt;
* [[How to use the JToolBar class in the frontend]]&lt;br /&gt;
* [[Routing]]&lt;br /&gt;
* [[Joomla Routes and SEF]]&lt;br /&gt;
* [[API Execution Order]]&lt;br /&gt;
* [[Accessing the current user object]]&lt;br /&gt;
* [[Adding JavaScript and CSS to the page]]&lt;br /&gt;
* [[Constants]] used in the Joomla [[Framework]].&lt;br /&gt;
* [[Form validation]]&lt;br /&gt;
* [[How to create a custom button]]&lt;br /&gt;
* [[How to create a stand-alone application using the Joomla! Framework]]&lt;br /&gt;
* [[How to use user state variables]]&lt;br /&gt;
* [[Adding template overridable images in your extension]]&lt;br /&gt;
* [[Retrieving data from GET and POST requests]]&lt;br /&gt;
* [[Using caching to speed up your code]]&lt;br /&gt;
* [[Using a custom image in the menu bar title]]&lt;br /&gt;
* [[Using the installer API to support package installation]]&lt;br /&gt;
* [[Tutorial:How to add tooltips to your Joomla! website]]&lt;br /&gt;
* [[Xml-rpc|XML-RPC]]&lt;br /&gt;
* [[How to add breadcrumbs]]&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Development ==&lt;br /&gt;
The development of Joomla itself is carried out by the [[Development Working Group]] and third party developers.&lt;br /&gt;
&lt;br /&gt;
* [[Participating in the community]]: a brief description of how people can get involved.&lt;br /&gt;
* [[Developer Email lists]]: a list of email lists for developers, including third party developers.&lt;br /&gt;
* [[Coding style and standards]] (To be reviewed).&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development_--_Part_2#Check_Out_Joomla.21_Source_Code How to check out SVN Code]&lt;br /&gt;
* [[Patch submission guidelines]].&lt;br /&gt;
* [[Filing bugs and issues]].&lt;br /&gt;
* [[How to release a distribution tarball]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Developer Documentation ==&lt;br /&gt;
The development of Joomla developer documentation is carried out primarily by the [[Documentation Working Group]].  There are currently two sub-projects of interest to developers:&lt;br /&gt;
* [[Joomla! 1.5 Template Tutorials Project]]&lt;br /&gt;
* [[API Reference Project]]&lt;br /&gt;
&lt;br /&gt;
When creating a new page, ensure you place the following marker at the bottom of the page so it is included in the category list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Development]]&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you locate other articles you think are relevant to developers, please add this marker to those pages.&lt;br /&gt;
&lt;br /&gt;
=== Suggested topics ===&lt;br /&gt;
This is a short list of articles that might be written to support developers.  Please feel free to add further topic ideas.&lt;br /&gt;
&lt;br /&gt;
* [[Adding configuration objects to modules and plugins]].&lt;br /&gt;
* [[Storing data in the session between page loads]].&lt;br /&gt;
* [[Suppressing output of extra HTML]].&lt;br /&gt;
* [[How to use the filter package]].&lt;br /&gt;
*: Describe how and when to use the Filter package and explain what needs to be filtered for various situations (for queries, for URLs, etc)&lt;br /&gt;
* [[How to use the registry package]]&lt;br /&gt;
* [[How to use JSimpleXML]].&lt;br /&gt;
*: How to load and store XML files and how to work with them&lt;br /&gt;
* [[How to create component feeds]] (RSS/ATOM)&lt;br /&gt;
* [[How to create PDF views]]&lt;br /&gt;
* [[How to generate paths for client side and server side]]&lt;br /&gt;
* [[How to access information from the request]]&lt;br /&gt;
*: This focuses on using the JBrowser class to retrieve information about the features available in the user&#039;s browser.&lt;br /&gt;
* [[How to create an editor plugin]]&lt;br /&gt;
* [[What can be done with a user plugin]]&lt;br /&gt;
* [[How to work with parameters]]&lt;br /&gt;
* [[How to cloak email addresses]]&lt;br /&gt;
* [[Using the caching system in your component]].&lt;br /&gt;
&lt;br /&gt;
==Joomla Security Guide==&lt;br /&gt;
Developers should also be aware of security issues.&lt;br /&gt;
{{Security Guide}}&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15789</id>
		<title>Portal:Developers</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Portal:Developers&amp;diff=15789"/>
		<updated>2009-09-29T23:52:40Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Suggested topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer profile}}&lt;br /&gt;
&lt;br /&gt;
A complete contents list of all pages of interest to developers can be found in the [[:Category:Development|development category]].&lt;br /&gt;
&lt;br /&gt;
== Reference Material ==&lt;br /&gt;
&lt;br /&gt;
* [[Framework|Joomla Framework]].&lt;br /&gt;
* [http://api.joomla.org API documentation] automatically generated using phpDocumentor.&lt;br /&gt;
&lt;br /&gt;
== Articles and Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [[Setting up your workstation for extension development]] A guide to Joomla Extension development&lt;br /&gt;
* [http://community.joomla.org/blogs/community/828-webinar-using-eclipse-for-joomla-development.html Using Eclipse for Joomla! Development] Video webinar demonstrating overview of Eclipse features for Joomla! development&lt;br /&gt;
* [[Do not use die to debug]]&lt;br /&gt;
* [[How to debug your code]]&lt;br /&gt;
* [[Tutorial:Adapting Joomla 1.0 extensions to Joomla 1.5]]&lt;br /&gt;
* [[Version 1.6 Developer Notes]]&lt;br /&gt;
* [[Tutorial:Joomla Beginning Developer Course]]&lt;br /&gt;
&lt;br /&gt;
=== Components ===&lt;br /&gt;
* Developing a Model-View-Controller (MVC) Component&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
** [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
* [[File Structure and Naming Conventions]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Components:xml installfile]].  An example component XML installation file.&lt;br /&gt;
* [[How to use the JPane classes in a component]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Adding Javascript moo.fx to your component WIP]]&lt;br /&gt;
* [[Creating a toolbar for your component]]&lt;br /&gt;
* [[Adding view layout configuration parameters]]&lt;br /&gt;
* [[How to implement XML-RPC in a component]]&lt;br /&gt;
* [[Using JPagination in your component]]&lt;br /&gt;
* [[Adding sortable columns to a table in a component]]&lt;br /&gt;
* [[Using multiple models in an MVC component]]&lt;br /&gt;
* [[Ajax using MooTools]]&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
* [[Tutorial:Creating a Hello World Module for Joomla_1.5]]&lt;br /&gt;
* [[How to create a module]]&lt;br /&gt;
&lt;br /&gt;
=== Plugins ===&lt;br /&gt;
* [[Plugin Developer Overview]]&lt;br /&gt;
* [[Tutorial:Plugins]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/184-how-to-create-a-joomla-plugin.html How to create a Joomla! Plugin]&lt;br /&gt;
* [[How to create a content plugin]]&lt;br /&gt;
* [[How to create a search plugin]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Tutorial:Creating an Authentication Plugin for Joomla 1.5]]&lt;br /&gt;
* [[Tutorial:Using plugins in your own extension]]&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
* [[Understanding Output Overrides]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/165-understanding-output-overrides-in-joomla.html Understanding Output Overrides in Joomla! 1.5]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
* [[How are templates executed?]]&lt;br /&gt;
* [[How to determine if the user is viewing the front page]]&lt;br /&gt;
* [[Tutorial:Template parameters]]&lt;br /&gt;
&lt;br /&gt;
===Parameters===&lt;br /&gt;
* [[Standard parameter types]]&lt;br /&gt;
* [[Custom parameter types]]&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Creating custom template parameter types]]&lt;br /&gt;
See also: [[:Category:Parameters]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* [[How to add CSRF anti-spoofing to forms]]&lt;br /&gt;
* [http://developer.joomla.org/tutorials/181-preventing-sql-injections.html Preventing SQL Injections]&lt;br /&gt;
&lt;br /&gt;
=== Database ===&lt;br /&gt;
* [[How to use the database classes in your script]]&lt;br /&gt;
* [[How to use the JTable class]]&lt;br /&gt;
* [[How to connect to an external database]]&lt;br /&gt;
&lt;br /&gt;
=== Localisation ===&lt;br /&gt;
* [http://community.joomla.org/magazine/article/508-developer-localization-advancements-in-joomla-15.html Localization Advancements in Joomla! 1.5]&lt;br /&gt;
* [[Adding multi-language support]]&lt;br /&gt;
* [[Adding Joomfish functionality to custom components]]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[How to use the filesystem package]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Adding AJAX to your component]].&lt;br /&gt;
* [[How to send email from components]]&lt;br /&gt;
* [[How to use the JToolBar class in the frontend]]&lt;br /&gt;
* [[Routing]]&lt;br /&gt;
* [[Joomla Routes and SEF]]&lt;br /&gt;
* [[API Execution Order]]&lt;br /&gt;
* [[Accessing the current user object]]&lt;br /&gt;
* [[Adding JavaScript and CSS to the page]]&lt;br /&gt;
* [[Constants]] used in the Joomla [[Framework]].&lt;br /&gt;
* [[Form validation]]&lt;br /&gt;
* [[How to create a custom button]]&lt;br /&gt;
* [[How to create a stand-alone application using the Joomla! Framework]]&lt;br /&gt;
* [[How to use user state variables]]&lt;br /&gt;
* [[Adding template overridable images in your extension]]&lt;br /&gt;
* [[Retrieving data from GET and POST requests]]&lt;br /&gt;
* [[Using caching to speed up your code]]&lt;br /&gt;
* [[Using a custom image in the menu bar title]]&lt;br /&gt;
* [[Using the installer API to support package installation]]&lt;br /&gt;
* [[Tutorial:How to add tooltips to your Joomla! website]]&lt;br /&gt;
* [[Xml-rpc|XML-RPC]]&lt;br /&gt;
* [[How to add breadcrumbs]]&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Development ==&lt;br /&gt;
The development of Joomla itself is carried out by the [[Development Working Group]] and third party developers.&lt;br /&gt;
&lt;br /&gt;
* [[Participating in the community]]: a brief description of how people can get involved.&lt;br /&gt;
* [[Developer Email lists]]: a list of email lists for developers, including third party developers.&lt;br /&gt;
* [[Coding style and standards]] (To be reviewed).&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]].  A step-by-step guide to installing the Eclipse IDE on your local workstation for Joomla! development.&lt;br /&gt;
* [http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development_--_Part_2#Check_Out_Joomla.21_Source_Code How to check out SVN Code]&lt;br /&gt;
* [[Patch submission guidelines]].&lt;br /&gt;
* [[Filing bugs and issues]].&lt;br /&gt;
* [[How to release a distribution tarball]].&lt;br /&gt;
&lt;br /&gt;
== Contributing to Joomla Developer Documentation ==&lt;br /&gt;
The development of Joomla developer documentation is carried out primarily by the [[Documentation Working Group]].  There are currently two sub-projects of interest to developers:&lt;br /&gt;
* [[Joomla! 1.5 Template Tutorials Project]]&lt;br /&gt;
* [[API Reference Project]]&lt;br /&gt;
&lt;br /&gt;
When creating a new page, ensure you place the following marker at the bottom of the page so it is included in the category list:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;[[Category:Development]]&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you locate other articles you think are relevant to developers, please add this marker to those pages.&lt;br /&gt;
&lt;br /&gt;
=== Suggested topics ===&lt;br /&gt;
This is a short list of articles that might be written to support developers.  Please feel free to add further topic ideas.&lt;br /&gt;
&lt;br /&gt;
* [[Adding configuration objects to modules and plugins]].&lt;br /&gt;
* [[Storing data in the session between page loads]].&lt;br /&gt;
* [[Creating a file uploader in your component]].&lt;br /&gt;
* [[Suppressing output of extra HTML]].&lt;br /&gt;
* [[How to use the filter package]].&lt;br /&gt;
*: Describe how and when to use the Filter package and explain what needs to be filtered for various situations (for queries, for URLs, etc)&lt;br /&gt;
* [[How to use the registry package]]&lt;br /&gt;
* [[How to use JSimpleXML]].&lt;br /&gt;
*: How to load and store XML files and how to work with them&lt;br /&gt;
* [[How to create component feeds]] (RSS/ATOM)&lt;br /&gt;
* [[How to create PDF views]]&lt;br /&gt;
* [[How to generate paths for client side and server side]]&lt;br /&gt;
* [[How to access information from the request]]&lt;br /&gt;
*: This focuses on using the JBrowser class to retrieve information about the features available in the user&#039;s browser.&lt;br /&gt;
* [[How to create an editor plugin]]&lt;br /&gt;
* [[What can be done with a user plugin]]&lt;br /&gt;
* [[How to work with parameters]]&lt;br /&gt;
* [[How to cloak email addresses]]&lt;br /&gt;
&lt;br /&gt;
==Joomla Security Guide==&lt;br /&gt;
Developers should also be aware of security issues.&lt;br /&gt;
{{Security Guide}}&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15788</id>
		<title>Archived:Creating a file uploader in your component</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15788"/>
		<updated>2009-09-29T23:51:48Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Part 3: Adding The Head Javascript */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating a file uploader in your component: Method 1, SWFUpload ==&lt;br /&gt;
&lt;br /&gt;
=== Part 1: Introduction ===&lt;br /&gt;
&lt;br /&gt;
SWFUpload is a free open source multiple file uploader available for download from http://swfupload.org/&lt;br /&gt;
&lt;br /&gt;
A demo of swfupload is available here: http://demo.swfupload.org/v220/simpledemo/index.php&lt;br /&gt;
&lt;br /&gt;
The standard way to upload a file is with a HTML form. This works great if you are uploading one file, but browsers do not let you select and upload more than one file at a time.&lt;br /&gt;
&lt;br /&gt;
The most common way of selecting multiple files for upload is to use flash and javascript. The flash part of the script opens up a selct file dialog where multiple files can be selected, and the flash/javascript sends each file, and recieves the response from the server.&lt;br /&gt;
&lt;br /&gt;
The most popular scripts used to do this are SWFUpload and Fancy upload (http://digitarald.de/project/fancyupload/). The flash uploader in Joomla&#039;s media manager is based on Fancy Upload version 1.0. As Fancy upload 2.0 and 3.0 use mootools 1.2, and Joomla 1.5 uses mootools 1.11, we can not use Fancy Upload 2.0/3.0 in the admin pages of Joomla. Fancy Upload 1.0 could be used, but it is not updated or supported anymore.&lt;br /&gt;
&lt;br /&gt;
SWFUpload does not use Mootools or Jquery. Because of this it will likely work on any page with Mootools 1.11 (Joomla 1.5), or Mootools 1.2 (Joomla 1.6). Therefore we will be using SWFUpload in this article.&lt;br /&gt;
&lt;br /&gt;
Download ths latest version of SWFUpload from the download page (http://code.google.com/p/swfupload/). Download the SWFUpload v2.2.0.1 Samples.zip file.&lt;br /&gt;
&lt;br /&gt;
Inside the file there will be a demos folder, and inside that a simpledemo folder. This is the example we are going to integrate into a Joomla component.&lt;br /&gt;
&lt;br /&gt;
This tutorial assumes you have followed the http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 tutorial and are familiar with Joomla&#039;s MVC structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 2: Adding The External Javascript ===&lt;br /&gt;
&lt;br /&gt;
We need to add in the external links in the head of the document, put some javascript into the head of the doc, and put some HTML in our body.&lt;br /&gt;
&lt;br /&gt;
If you look at the simpledemo/index.php page you will see links to 5 files in the head of the page.&lt;br /&gt;
&lt;br /&gt;
Make a folder within the root of your components folder called swfupload, copy the ../css/default.css, ../swfupload/swfupload.js, js/swfupload.queue.js, js/fileprogress.js and js/handlers.js files into this folder.&lt;br /&gt;
&lt;br /&gt;
We also need to copy the ../swfupload/swfupload.swf and images/TestImageNoText_65x29.png files into this folder.&lt;br /&gt;
&lt;br /&gt;
Within your view.html.php file add in the following code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//get the hosts name&lt;br /&gt;
jimport(&#039;joomla.environment.uri&#039; );&lt;br /&gt;
$host = JURI::root();&lt;br /&gt;
&lt;br /&gt;
//add the links to the external files into the head of the webpage (note the &#039;administrator&#039; in the path, which is not nescessary if you are in the frontend)&lt;br /&gt;
$document =&amp;amp; JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.queue.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/fileprogress.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/handlers.js&#039;);&lt;br /&gt;
$document-&amp;gt;addStyleSheet($host.&#039;administrator/components/com_mycomponent/swfupload/default.css&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
That is the external files part done. We still have to add in the head javascript, and the body html.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Part 3: Adding The Head Javascript ===&lt;br /&gt;
&lt;br /&gt;
Head javascript part:&lt;br /&gt;
The javascript below is almost the same as the javascript from the simple demo, the few modifications are commented. It is nescessary to read through it and change the parts (such as task) that are relevant to your component.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//when we send the files for upload, we have to tell Joomla our session, or we will get logged out &lt;br /&gt;
$session = &amp;amp; JFactory::getSession();&lt;br /&gt;
		&lt;br /&gt;
$swfUploadHeadJs =&#039;&lt;br /&gt;
var swfu;&lt;br /&gt;
&lt;br /&gt;
window.onload = function()&lt;br /&gt;
{&lt;br /&gt;
			&lt;br /&gt;
var settings = &lt;br /&gt;
{&lt;br /&gt;
        //this is the path to the flash file, you need to put your components name into it&lt;br /&gt;
	flash_url : &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.swf&amp;quot;,&lt;br /&gt;
	&lt;br /&gt;
        //we can not put any vars into the url for complicated reasons, but we can put them into the post...&lt;br /&gt;
        upload_url: &amp;quot;index.php&amp;quot;,&lt;br /&gt;
	post_params: &lt;br /&gt;
	{&lt;br /&gt;
		&amp;quot;option&amp;quot; : &amp;quot;com_mycomponent&amp;quot;,&lt;br /&gt;
		&amp;quot;controller&amp;quot; : &amp;quot;mycontroller&amp;quot;,&lt;br /&gt;
		&amp;quot;task&amp;quot; : &amp;quot;mytask&amp;quot;,&lt;br /&gt;
		&amp;quot;id&amp;quot; : &amp;quot;&#039;.$myItemObject-&amp;gt;id.&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;&#039;.$session-&amp;gt;getName().&#039;&amp;quot; : &amp;quot;&#039;.$session-&amp;gt;getId().&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;format&amp;quot; : &amp;quot;raw&amp;quot;&lt;br /&gt;
	}, &lt;br /&gt;
        //you need to put the session and the &#039;format raw&#039; in there, the other ones are what you would normally put in the url&lt;br /&gt;
	file_size_limit : &amp;quot;5 MB&amp;quot;,&lt;br /&gt;
        //client side file chacking is for usability only, you need to check server side for security&lt;br /&gt;
	file_types : &amp;quot;*.jpg;*.jpeg;*.gif;*.png&amp;quot;,&lt;br /&gt;
	file_types_description : &amp;quot;All Files&amp;quot;,&lt;br /&gt;
	file_upload_limit : 100,&lt;br /&gt;
	file_queue_limit : 100,&lt;br /&gt;
	custom_settings : &lt;br /&gt;
	{&lt;br /&gt;
		progressTarget : &amp;quot;fsUploadProgress&amp;quot;,&lt;br /&gt;
		cancelButtonId : &amp;quot;btnCancel&amp;quot;&lt;br /&gt;
	},&lt;br /&gt;
	debug: false,&lt;br /&gt;
&lt;br /&gt;
	// Button settings&lt;br /&gt;
	button_image_url: &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/images/TestImageNoText_65x29.png&amp;quot;,&lt;br /&gt;
	button_width: &amp;quot;85&amp;quot;,&lt;br /&gt;
	button_height: &amp;quot;29&amp;quot;,&lt;br /&gt;
	button_placeholder_id: &amp;quot;spanButtonPlaceHolder&amp;quot;,&lt;br /&gt;
	button_text: \&#039;&amp;lt;span class=&amp;quot;theFont&amp;quot;&amp;gt;Choose Files&amp;lt;/span&amp;gt;\&#039;,&lt;br /&gt;
	button_text_style: &amp;quot;.theFont { font-size: 13; }&amp;quot;,&lt;br /&gt;
	button_text_left_padding: 5,&lt;br /&gt;
	button_text_top_padding: 5,&lt;br /&gt;
				&lt;br /&gt;
	// The event handler functions are defined in handlers.js&lt;br /&gt;
	file_queued_handler : fileQueued,&lt;br /&gt;
	file_queue_error_handler : fileQueueError,&lt;br /&gt;
	file_dialog_complete_handler : fileDialogComplete,&lt;br /&gt;
	upload_start_handler : uploadStart,&lt;br /&gt;
	upload_progress_handler : uploadProgress,&lt;br /&gt;
	upload_error_handler : uploadError,&lt;br /&gt;
	upload_success_handler : uploadSuccess,&lt;br /&gt;
	upload_complete_handler : uploadComplete,&lt;br /&gt;
	queue_complete_handler : queueComplete	// Queue plugin event&lt;br /&gt;
};&lt;br /&gt;
swfu = new SWFUpload(settings);&lt;br /&gt;
};&lt;br /&gt;
	     &lt;br /&gt;
&#039;;&lt;br /&gt;
&lt;br /&gt;
//add the javascript to the head of the html document&lt;br /&gt;
$document-&amp;gt;addScriptDeclaration($swfUploadHeadJs);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want more info on what each paramater is, have a look at the swfupload docs:&lt;br /&gt;
http://demo.swfupload.org/Documentation/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 4: Adding The Body HTML ===&lt;br /&gt;
&lt;br /&gt;
We still have to add in our body HTML, in you tmpl/default.php file add in:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;swfuploader&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;form id=&amp;quot;form1&amp;quot; action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; enctype=&amp;quot;multipart/form-data&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
			&amp;lt;div class=&amp;quot;fieldset flash&amp;quot; id=&amp;quot;fsUploadProgress&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;span class=&amp;quot;legend&amp;quot;&amp;gt;Upload Queue&amp;lt;/span&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div id=&amp;quot;divStatus&amp;quot;&amp;gt;0 Files Uploaded&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;div&amp;gt;&lt;br /&gt;
				&amp;lt;span id=&amp;quot;spanButtonPlaceHolder&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
				&amp;lt;input id=&amp;quot;btnCancel&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Cancel All Uploads&amp;quot; onclick=&amp;quot;swfu.cancelQueue();&amp;quot; disabled=&amp;quot;disabled&amp;quot; style=&amp;quot;margin-left: 2px; font-size: 8pt; height: 29px;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
	&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all has gone well, you will be able to upload files to your components script, although nothing will happen on the server as there is no PHP to recieve the image.&lt;br /&gt;
&lt;br /&gt;
===  Part 5: Recieveing The File With PHP ===&lt;br /&gt;
&lt;br /&gt;
It is worth noting that allowing users to upload files to the server is possibly the most dangerous thing to do in terms of security, and if someone with malicious intentions manages to upload a php file to your server, then they can easily take control of the site.&lt;br /&gt;
&lt;br /&gt;
It is recommeneded you do some reading on file upload security. This is a good start:&lt;br /&gt;
&lt;br /&gt;
http://www.scanit.be/uploads/php-file-upload.pdf&lt;br /&gt;
&lt;br /&gt;
And there are many other good resources on the internet. It is important you understand how file upload security works, rather than copying and pasting some code that checks the MIME type, and assuming the script is safe.&lt;br /&gt;
&lt;br /&gt;
Here is some example PHP that will check if the file is an image, and upload it. It is not an exhaustive example of security checking, but it is a good start:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//import joomlas filesystem functions, we will do all the filewriting with joomlas functions,&lt;br /&gt;
//so if the ftp layer is on, joomla will write with that, not the apache user, which might&lt;br /&gt;
//not have the correct permissions&lt;br /&gt;
jimport(&#039;joomla.filesystem.file&#039;);&lt;br /&gt;
jimport(&#039;joomla.filesystem.folder&#039;);&lt;br /&gt;
		&lt;br /&gt;
//this is the name of the field in the html form, filedata is the default name for swfupload&lt;br /&gt;
//so we will leave it as that&lt;br /&gt;
$fieldName = &#039;Filedata&#039;;&lt;br /&gt;
&lt;br /&gt;
//any errors the server registered on uploading&lt;br /&gt;
$fileError = $_FILES[$fieldName][&#039;error&#039;];&lt;br /&gt;
if ($fileError &amp;gt; 0) &lt;br /&gt;
{&lt;br /&gt;
        switch ($fileError) &lt;br /&gt;
	{&lt;br /&gt;
        case 1:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN PHP INI ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 2:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN HTML FORM ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 3:&lt;br /&gt;
        echo JText::_( &#039;ERROR PARTIAL UPLOAD&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 4:&lt;br /&gt;
        echo JText::_( &#039;ERROR NO FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check for filesize&lt;br /&gt;
$fileSize = $_FILES[$fieldName][&#039;size&#039;];&lt;br /&gt;
if($fileSize &amp;gt; 2000000)&lt;br /&gt;
{&lt;br /&gt;
    echo JText::_( &#039;FILE BIGGER THAN 2MB&#039; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check the file extension is ok&lt;br /&gt;
$fileName = $_FILES[$fieldName][&#039;name&#039;];&lt;br /&gt;
$uploadedFileNameParts = explode(&#039;.&#039;,$fileName);&lt;br /&gt;
$uploadedFileExtension = array_pop($uploadedFileNameParts);&lt;br /&gt;
&lt;br /&gt;
$okFileExtensions = &#039;jpeg,jpg,png,gif&#039;;&lt;br /&gt;
$validFileExts = explode(&amp;quot;,&amp;quot;, $extAccept);&lt;br /&gt;
&lt;br /&gt;
//assume the extension is false until we know its ok&lt;br /&gt;
$extOk = false;&lt;br /&gt;
&lt;br /&gt;
//go through every ok extension, if the ok extension matches the file extension (case insensitive)&lt;br /&gt;
//then the file extension is ok&lt;br /&gt;
foreach($validFileExts as $key =&amp;gt; $value)&lt;br /&gt;
{&lt;br /&gt;
	if( preg_match(&amp;quot;/$value/i&amp;quot;, $uploadedFileExtension ) )&lt;br /&gt;
	{&lt;br /&gt;
		$extOk = true;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ($extOk == false) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID EXTENSION&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
//the name of the file in PHP&#039;s temp directory that we are going to move to our folder&lt;br /&gt;
$fileTemp = $_FILES[$fieldName][&#039;tmp_name&#039;];&lt;br /&gt;
		&lt;br /&gt;
//for security purposes, we will also do a getimagesize on the temp file (before we have moved it &lt;br /&gt;
//to the folder) to check the MIME type of the file, and whether it has a width and height&lt;br /&gt;
$imageinfo = getimagesize($fileTemp);&lt;br /&gt;
		&lt;br /&gt;
//we are going to define what file extensions/MIMEs are ok, and only let these ones in (whitelisting), rather than try to scan for bad&lt;br /&gt;
//types, where we might miss one (whitelisting is always better than blacklisting) &lt;br /&gt;
$okMIMETypes = &#039;image/jpeg,image/pjpeg,image/png,imagex-png,image/gif&#039;;&lt;br /&gt;
$validFileTypes = explode(&amp;quot;,&amp;quot;, $accept);		&lt;br /&gt;
&lt;br /&gt;
//if the temp file does not have a width or a height, or it has a non ok MIME, return&lt;br /&gt;
if( !is_int($imageinfo[0]) || !is_int($imageinfo[1]) ||  !in_array($imageinfo[&#039;mime&#039;], $validFileTypes) )&lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID FILETYPE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//lose any special characters in the filename&lt;br /&gt;
$fileName = ereg_replace(&amp;quot;[^A-Za-z0-9.]&amp;quot;, &amp;quot;-&amp;quot;, $fileName);&lt;br /&gt;
&lt;br /&gt;
//always use constants when making file paths, to avoid the possibilty of remote file inclusion&lt;br /&gt;
$uploadPath = JPATH_SITE.DS.&#039;images&#039;.DS.&#039;stories&#039;.DS.$fileName;&lt;br /&gt;
&lt;br /&gt;
if(!JFile::upload($fileTemp, $uploadPath)) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;ERROR MOVING FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all want well the uploaded files will be in the images/stories folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Part 6: Flash plugin COOKIE bug on non-IE browsers ===&lt;br /&gt;
&lt;br /&gt;
Also you should pay attention to Flash player cookie bug!&lt;br /&gt;
&lt;br /&gt;
It is described here http://swfupload.org/forum/generaldiscussion/383&lt;br /&gt;
&lt;br /&gt;
The Flash Player Plugin for FireFox, Opera and Safari (and probably other non-IE based browsers) has a bug which sends persistent cookies from IE to the upload URL instead of the cookies from the browser. Session only cookies from IE are not sent.&lt;br /&gt;
&lt;br /&gt;
1) Any cookies from a non-IE browser (ie, authentication, login, etc) will not be sent with the file upload. Rather the cookies from IE will be sent. So, no cookies or the wrong cookies will be sent. In most cases this means sessions and cookie based authentication are lost when making an upload.&lt;br /&gt;
&lt;br /&gt;
2) Cookies set by the upload script do get set, but only for Flash. The browser will not see them.&lt;br /&gt;
&lt;br /&gt;
3) This bug affects Flash 8 and Flash 9 and all versions of SWFUpload&lt;br /&gt;
&lt;br /&gt;
4) You cannot rely on cookies when using SWFUpload (or any Flash based upload tool). You must send the data you need from the cookies in another way. There are several threads regarding this issue in the forum and many of the demos show workarounds for restoring PHP sessions and some sample files show how to restore the cookies so Session and Authentication are restored in ASP.Net.&lt;br /&gt;
&lt;br /&gt;
5) This could be considered a security issue but probably not severe enough to actually compromise any data. The cookies created in IE by Flash still have all the rules and restricts associated with cookies in any browser.&lt;br /&gt;
&lt;br /&gt;
Solution is modify function _start() (libraries\joomla\session\session.php):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$sn = session_name();&lt;br /&gt;
&lt;br /&gt;
if(isset($_COOKIE[$sn]) &amp;amp;&amp;amp; isset($_POST[$sn])) &lt;br /&gt;
   {&lt;br /&gt;
	$_COOKIE[$sn] = $_POST[$sn];&lt;br /&gt;
	session_id($_POST[$sn]);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
session_start();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15787</id>
		<title>Archived:Creating a file uploader in your component</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15787"/>
		<updated>2009-09-29T23:50:26Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Part 3: Adding The Head Javascript */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating a file uploader in your component: Method 1, SWFUpload ==&lt;br /&gt;
&lt;br /&gt;
=== Part 1: Introduction ===&lt;br /&gt;
&lt;br /&gt;
SWFUpload is a free open source multiple file uploader available for download from http://swfupload.org/&lt;br /&gt;
&lt;br /&gt;
A demo of swfupload is available here: http://demo.swfupload.org/v220/simpledemo/index.php&lt;br /&gt;
&lt;br /&gt;
The standard way to upload a file is with a HTML form. This works great if you are uploading one file, but browsers do not let you select and upload more than one file at a time.&lt;br /&gt;
&lt;br /&gt;
The most common way of selecting multiple files for upload is to use flash and javascript. The flash part of the script opens up a selct file dialog where multiple files can be selected, and the flash/javascript sends each file, and recieves the response from the server.&lt;br /&gt;
&lt;br /&gt;
The most popular scripts used to do this are SWFUpload and Fancy upload (http://digitarald.de/project/fancyupload/). The flash uploader in Joomla&#039;s media manager is based on Fancy Upload version 1.0. As Fancy upload 2.0 and 3.0 use mootools 1.2, and Joomla 1.5 uses mootools 1.11, we can not use Fancy Upload 2.0/3.0 in the admin pages of Joomla. Fancy Upload 1.0 could be used, but it is not updated or supported anymore.&lt;br /&gt;
&lt;br /&gt;
SWFUpload does not use Mootools or Jquery. Because of this it will likely work on any page with Mootools 1.11 (Joomla 1.5), or Mootools 1.2 (Joomla 1.6). Therefore we will be using SWFUpload in this article.&lt;br /&gt;
&lt;br /&gt;
Download ths latest version of SWFUpload from the download page (http://code.google.com/p/swfupload/). Download the SWFUpload v2.2.0.1 Samples.zip file.&lt;br /&gt;
&lt;br /&gt;
Inside the file there will be a demos folder, and inside that a simpledemo folder. This is the example we are going to integrate into a Joomla component.&lt;br /&gt;
&lt;br /&gt;
This tutorial assumes you have followed the http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 tutorial and are familiar with Joomla&#039;s MVC structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 2: Adding The External Javascript ===&lt;br /&gt;
&lt;br /&gt;
We need to add in the external links in the head of the document, put some javascript into the head of the doc, and put some HTML in our body.&lt;br /&gt;
&lt;br /&gt;
If you look at the simpledemo/index.php page you will see links to 5 files in the head of the page.&lt;br /&gt;
&lt;br /&gt;
Make a folder within the root of your components folder called swfupload, copy the ../css/default.css, ../swfupload/swfupload.js, js/swfupload.queue.js, js/fileprogress.js and js/handlers.js files into this folder.&lt;br /&gt;
&lt;br /&gt;
We also need to copy the ../swfupload/swfupload.swf and images/TestImageNoText_65x29.png files into this folder.&lt;br /&gt;
&lt;br /&gt;
Within your view.html.php file add in the following code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//get the hosts name&lt;br /&gt;
jimport(&#039;joomla.environment.uri&#039; );&lt;br /&gt;
$host = JURI::root();&lt;br /&gt;
&lt;br /&gt;
//add the links to the external files into the head of the webpage (note the &#039;administrator&#039; in the path, which is not nescessary if you are in the frontend)&lt;br /&gt;
$document =&amp;amp; JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.queue.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/fileprogress.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/handlers.js&#039;);&lt;br /&gt;
$document-&amp;gt;addStyleSheet($host.&#039;administrator/components/com_mycomponent/swfupload/default.css&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
That is the external files part done. We still have to add in the head javascript, and the body html.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Part 3: Adding The Head Javascript ===&lt;br /&gt;
&lt;br /&gt;
Head javascript part:&lt;br /&gt;
The javascript below is almost the same as the javascript from the simple demo, the few modifications are commented. It is nescessary to read through it and change the parts (such as task) that are relevant to your component.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//when we send the files for upload, we have to tell Joomla our session, or we will get logged out &lt;br /&gt;
$session = &amp;amp; JFactory::getSession();&lt;br /&gt;
		&lt;br /&gt;
$swfUploadHeadJs =&#039;&lt;br /&gt;
var swfu;&lt;br /&gt;
&lt;br /&gt;
window.onload = function()&lt;br /&gt;
{&lt;br /&gt;
			&lt;br /&gt;
var settings = &lt;br /&gt;
{&lt;br /&gt;
        //this is the path to the flash file, you need to put your components name into it&lt;br /&gt;
	flash_url : &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.swf&amp;quot;,&lt;br /&gt;
	&lt;br /&gt;
        //we can not put any vars into the url for complicated reasons, but we can put them into the post...&lt;br /&gt;
        upload_url: &amp;quot;index.php&amp;quot;,&lt;br /&gt;
	post_params: &lt;br /&gt;
	{&lt;br /&gt;
		&amp;quot;option&amp;quot; : &amp;quot;com_mycomponent&amp;quot;,&lt;br /&gt;
		&amp;quot;controller&amp;quot; : &amp;quot;mycontroller&amp;quot;,&lt;br /&gt;
		&amp;quot;task&amp;quot; : &amp;quot;mytask&amp;quot;,&lt;br /&gt;
		&amp;quot;id&amp;quot; : &amp;quot;&#039;.$myItemObject-&amp;gt;id.&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;&#039;.$session-&amp;gt;getName().&#039;&amp;quot; : &amp;quot;&#039;.$session-&amp;gt;getId().&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;format&amp;quot; : &amp;quot;raw&amp;quot;&lt;br /&gt;
	}, &lt;br /&gt;
        //you need to put the session and the &#039;format raw&#039; in there, the other ones are what you would normally put in the url&lt;br /&gt;
	file_size_limit : &amp;quot;5 MB&amp;quot;,&lt;br /&gt;
        //client side file chacking is for usability only, you need to check server side for security&lt;br /&gt;
	file_types : &amp;quot;*.jpg;*.jpeg;*.gif;*.png&amp;quot;,&lt;br /&gt;
	file_types_description : &amp;quot;All Files&amp;quot;,&lt;br /&gt;
	file_upload_limit : 100,&lt;br /&gt;
	file_queue_limit : 100,&lt;br /&gt;
	custom_settings : &lt;br /&gt;
	{&lt;br /&gt;
		progressTarget : &amp;quot;fsUploadProgress&amp;quot;,&lt;br /&gt;
		cancelButtonId : &amp;quot;btnCancel&amp;quot;&lt;br /&gt;
	},&lt;br /&gt;
	debug: false,&lt;br /&gt;
&lt;br /&gt;
	// Button settings&lt;br /&gt;
	button_image_url: &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/images/TestImageNoText_65x29.png&amp;quot;,&lt;br /&gt;
	button_width: &amp;quot;85&amp;quot;,&lt;br /&gt;
	button_height: &amp;quot;29&amp;quot;,&lt;br /&gt;
	button_placeholder_id: &amp;quot;spanButtonPlaceHolder&amp;quot;,&lt;br /&gt;
	button_text: \&#039;&amp;lt;span class=&amp;quot;theFont&amp;quot;&amp;gt;Choose Files&amp;lt;/span&amp;gt;\&#039;,&lt;br /&gt;
	button_text_style: &amp;quot;.theFont { font-size: 13; }&amp;quot;,&lt;br /&gt;
	button_text_left_padding: 5,&lt;br /&gt;
	button_text_top_padding: 5,&lt;br /&gt;
				&lt;br /&gt;
	// The event handler functions are defined in handlers.js&lt;br /&gt;
	file_queued_handler : fileQueued,&lt;br /&gt;
	file_queue_error_handler : fileQueueError,&lt;br /&gt;
	file_dialog_complete_handler : fileDialogComplete,&lt;br /&gt;
	upload_start_handler : uploadStart,&lt;br /&gt;
	upload_progress_handler : uploadProgress,&lt;br /&gt;
	upload_error_handler : uploadError,&lt;br /&gt;
	upload_success_handler : uploadSuccess,&lt;br /&gt;
	upload_complete_handler : uploadComplete,&lt;br /&gt;
	queue_complete_handler : queueComplete	// Queue plugin event&lt;br /&gt;
};&lt;br /&gt;
swfu = new SWFUpload(settings);&lt;br /&gt;
};&lt;br /&gt;
	     &lt;br /&gt;
&#039;;&lt;br /&gt;
&lt;br /&gt;
//add the javascript to the head of the html document&lt;br /&gt;
$document-&amp;gt;addScriptDeclaration($swfUploadHeadJs);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want more info on what each paramater is, have a look at the swfupload docs:&lt;br /&gt;
http://demo.swfupload.org/Documentation/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 4: Adding The Body HTML ===&lt;br /&gt;
&lt;br /&gt;
We still have to add in our body HTML, in you tmpl/default.php file add in:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;swfuploader&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;form id=&amp;quot;form1&amp;quot; action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; enctype=&amp;quot;multipart/form-data&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
			&amp;lt;div class=&amp;quot;fieldset flash&amp;quot; id=&amp;quot;fsUploadProgress&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;span class=&amp;quot;legend&amp;quot;&amp;gt;Upload Queue&amp;lt;/span&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div id=&amp;quot;divStatus&amp;quot;&amp;gt;0 Files Uploaded&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;div&amp;gt;&lt;br /&gt;
				&amp;lt;span id=&amp;quot;spanButtonPlaceHolder&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
				&amp;lt;input id=&amp;quot;btnCancel&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Cancel All Uploads&amp;quot; onclick=&amp;quot;swfu.cancelQueue();&amp;quot; disabled=&amp;quot;disabled&amp;quot; style=&amp;quot;margin-left: 2px; font-size: 8pt; height: 29px;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
	&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all has gone well, you will be able to upload files to your components script, although nothing will happen on the server as there is no PHP to recieve the image.&lt;br /&gt;
&lt;br /&gt;
===  Part 5: Recieveing The File With PHP ===&lt;br /&gt;
&lt;br /&gt;
It is worth noting that allowing users to upload files to the server is possibly the most dangerous thing to do in terms of security, and if someone with malicious intentions manages to upload a php file to your server, then they can easily take control of the site.&lt;br /&gt;
&lt;br /&gt;
It is recommeneded you do some reading on file upload security. This is a good start:&lt;br /&gt;
&lt;br /&gt;
http://www.scanit.be/uploads/php-file-upload.pdf&lt;br /&gt;
&lt;br /&gt;
And there are many other good resources on the internet. It is important you understand how file upload security works, rather than copying and pasting some code that checks the MIME type, and assuming the script is safe.&lt;br /&gt;
&lt;br /&gt;
Here is some example PHP that will check if the file is an image, and upload it. It is not an exhaustive example of security checking, but it is a good start:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//import joomlas filesystem functions, we will do all the filewriting with joomlas functions,&lt;br /&gt;
//so if the ftp layer is on, joomla will write with that, not the apache user, which might&lt;br /&gt;
//not have the correct permissions&lt;br /&gt;
jimport(&#039;joomla.filesystem.file&#039;);&lt;br /&gt;
jimport(&#039;joomla.filesystem.folder&#039;);&lt;br /&gt;
		&lt;br /&gt;
//this is the name of the field in the html form, filedata is the default name for swfupload&lt;br /&gt;
//so we will leave it as that&lt;br /&gt;
$fieldName = &#039;Filedata&#039;;&lt;br /&gt;
&lt;br /&gt;
//any errors the server registered on uploading&lt;br /&gt;
$fileError = $_FILES[$fieldName][&#039;error&#039;];&lt;br /&gt;
if ($fileError &amp;gt; 0) &lt;br /&gt;
{&lt;br /&gt;
        switch ($fileError) &lt;br /&gt;
	{&lt;br /&gt;
        case 1:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN PHP INI ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 2:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN HTML FORM ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 3:&lt;br /&gt;
        echo JText::_( &#039;ERROR PARTIAL UPLOAD&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 4:&lt;br /&gt;
        echo JText::_( &#039;ERROR NO FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check for filesize&lt;br /&gt;
$fileSize = $_FILES[$fieldName][&#039;size&#039;];&lt;br /&gt;
if($fileSize &amp;gt; 2000000)&lt;br /&gt;
{&lt;br /&gt;
    echo JText::_( &#039;FILE BIGGER THAN 2MB&#039; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check the file extension is ok&lt;br /&gt;
$fileName = $_FILES[$fieldName][&#039;name&#039;];&lt;br /&gt;
$uploadedFileNameParts = explode(&#039;.&#039;,$fileName);&lt;br /&gt;
$uploadedFileExtension = array_pop($uploadedFileNameParts);&lt;br /&gt;
&lt;br /&gt;
$okFileExtensions = &#039;jpeg,jpg,png,gif&#039;;&lt;br /&gt;
$validFileExts = explode(&amp;quot;,&amp;quot;, $extAccept);&lt;br /&gt;
&lt;br /&gt;
//assume the extension is false until we know its ok&lt;br /&gt;
$extOk = false;&lt;br /&gt;
&lt;br /&gt;
//go through every ok extension, if the ok extension matches the file extension (case insensitive)&lt;br /&gt;
//then the file extension is ok&lt;br /&gt;
foreach($validFileExts as $key =&amp;gt; $value)&lt;br /&gt;
{&lt;br /&gt;
	if( preg_match(&amp;quot;/$value/i&amp;quot;, $uploadedFileExtension ) )&lt;br /&gt;
	{&lt;br /&gt;
		$extOk = true;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ($extOk == false) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID EXTENSION&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
//the name of the file in PHP&#039;s temp directory that we are going to move to our folder&lt;br /&gt;
$fileTemp = $_FILES[$fieldName][&#039;tmp_name&#039;];&lt;br /&gt;
		&lt;br /&gt;
//for security purposes, we will also do a getimagesize on the temp file (before we have moved it &lt;br /&gt;
//to the folder) to check the MIME type of the file, and whether it has a width and height&lt;br /&gt;
$imageinfo = getimagesize($fileTemp);&lt;br /&gt;
		&lt;br /&gt;
//we are going to define what file extensions/MIMEs are ok, and only let these ones in (whitelisting), rather than try to scan for bad&lt;br /&gt;
//types, where we might miss one (whitelisting is always better than blacklisting) &lt;br /&gt;
$okMIMETypes = &#039;image/jpeg,image/pjpeg,image/png,imagex-png,image/gif&#039;;&lt;br /&gt;
$validFileTypes = explode(&amp;quot;,&amp;quot;, $accept);		&lt;br /&gt;
&lt;br /&gt;
//if the temp file does not have a width or a height, or it has a non ok MIME, return&lt;br /&gt;
if( !is_int($imageinfo[0]) || !is_int($imageinfo[1]) ||  !in_array($imageinfo[&#039;mime&#039;], $validFileTypes) )&lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID FILETYPE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//lose any special characters in the filename&lt;br /&gt;
$fileName = ereg_replace(&amp;quot;[^A-Za-z0-9.]&amp;quot;, &amp;quot;-&amp;quot;, $fileName);&lt;br /&gt;
&lt;br /&gt;
//always use constants when making file paths, to avoid the possibilty of remote file inclusion&lt;br /&gt;
$uploadPath = JPATH_SITE.DS.&#039;images&#039;.DS.&#039;stories&#039;.DS.$fileName;&lt;br /&gt;
&lt;br /&gt;
if(!JFile::upload($fileTemp, $uploadPath)) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;ERROR MOVING FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all want well the uploaded files will be in the images/stories folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  Part 6: Flash plugin COOKIE bug on non-IE browsers ===&lt;br /&gt;
&lt;br /&gt;
Also you should pay attention to Flash player cookie bug!&lt;br /&gt;
&lt;br /&gt;
It is described here http://swfupload.org/forum/generaldiscussion/383&lt;br /&gt;
&lt;br /&gt;
The Flash Player Plugin for FireFox, Opera and Safari (and probably other non-IE based browsers) has a bug which sends persistent cookies from IE to the upload URL instead of the cookies from the browser. Session only cookies from IE are not sent.&lt;br /&gt;
&lt;br /&gt;
1) Any cookies from a non-IE browser (ie, authentication, login, etc) will not be sent with the file upload. Rather the cookies from IE will be sent. So, no cookies or the wrong cookies will be sent. In most cases this means sessions and cookie based authentication are lost when making an upload.&lt;br /&gt;
&lt;br /&gt;
2) Cookies set by the upload script do get set, but only for Flash. The browser will not see them.&lt;br /&gt;
&lt;br /&gt;
3) This bug affects Flash 8 and Flash 9 and all versions of SWFUpload&lt;br /&gt;
&lt;br /&gt;
4) You cannot rely on cookies when using SWFUpload (or any Flash based upload tool). You must send the data you need from the cookies in another way. There are several threads regarding this issue in the forum and many of the demos show workarounds for restoring PHP sessions and some sample files show how to restore the cookies so Session and Authentication are restored in ASP.Net.&lt;br /&gt;
&lt;br /&gt;
5) This could be considered a security issue but probably not severe enough to actually compromise any data. The cookies created in IE by Flash still have all the rules and restricts associated with cookies in any browser.&lt;br /&gt;
&lt;br /&gt;
Solution is modify function _start() (libraries\joomla\session\session.php):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$sn = session_name();&lt;br /&gt;
&lt;br /&gt;
if(isset($_COOKIE[$sn]) &amp;amp;&amp;amp; isset($_POST[$sn])) &lt;br /&gt;
   {&lt;br /&gt;
	$_COOKIE[$sn] = $_POST[$sn];&lt;br /&gt;
	session_id($_POST[$sn]);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
session_start();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15410</id>
		<title>Archived:Creating a file uploader in your component</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15410"/>
		<updated>2009-08-13T23:48:10Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: /* Part 3: Adding The Head Javascript */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating a file uploader in your component: Method 1, SWFUpload ==&lt;br /&gt;
&lt;br /&gt;
=== Part 1: Introduction ===&lt;br /&gt;
&lt;br /&gt;
SWFUpload is a free open source multiple file uploader available for download from http://swfupload.org/&lt;br /&gt;
&lt;br /&gt;
A demo of swfupload is available here: http://demo.swfupload.org/v220/simpledemo/index.php&lt;br /&gt;
&lt;br /&gt;
The standard way to upload a file is with a HTML form. This works great if you are uploading one file, but browsers do not let you select and upload more than one file at a time.&lt;br /&gt;
&lt;br /&gt;
The most common way of selecting multiple files for upload is to use flash and javascript. The flash part of the script opens up a selct file dialog where multiple files can be selected, and the flash/javascript sends each file, and recieves the response from the server.&lt;br /&gt;
&lt;br /&gt;
The most popular scripts used to do this are SWFUpload and Fancy upload (http://digitarald.de/project/fancyupload/). The flash uploader in Joomla&#039;s media manager is based on Fancy Upload version 1.0. As Fancy upload 2.0 and 3.0 use mootools 1.2, and Joomla 1.5 uses mootools 1.11, we can not use Fancy Upload 2.0/3.0 in the admin pages of Joomla. Fancy Upload 1.0 could be used, but it is not updated or supported anymore.&lt;br /&gt;
&lt;br /&gt;
SWFUpload does not use Mootools or Jquery. Because of this it will likely work on any page with Mootools 1.11 (Joomla 1.5), or Mootools 1.2 (Joomla 1.6). Therefore we will be using SWFUpload in this article.&lt;br /&gt;
&lt;br /&gt;
Download ths latest version of SWFUpload from the download page (http://code.google.com/p/swfupload/). Download the SWFUpload v2.2.0.1 Samples.zip file.&lt;br /&gt;
&lt;br /&gt;
Inside the file there will be a demos folder, and inside that a simpledemo folder. This is the example we are going to integrate into a Joomla component.&lt;br /&gt;
&lt;br /&gt;
This tutorial assumes you have followed the http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 tutorial and are familiar with Joomla&#039;s MVC structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 2: Adding The External Javascript ===&lt;br /&gt;
&lt;br /&gt;
We need to add in the external links in the head of the document, put some javascript into the head of the doc, and put some HTML in our body.&lt;br /&gt;
&lt;br /&gt;
If you look at the simpledemo/index.php page you will see links to 5 files in the head of the page.&lt;br /&gt;
&lt;br /&gt;
Make a folder within the root of your components folder called swfupload, copy the ../css/default.css, ../swfupload/swfupload.js, js/swfupload.queue.js, js/fileprogress.js and js/handlers.js files into this folder.&lt;br /&gt;
&lt;br /&gt;
We also need to copy the ../swfupload/swfupload.swf and images/TestImageNoText_65x29.png files into this folder.&lt;br /&gt;
&lt;br /&gt;
Within your view.html.php file add in the following code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//get the hosts name&lt;br /&gt;
jimport(&#039;joomla.environment.uri&#039; );&lt;br /&gt;
$host = JURI::root();&lt;br /&gt;
&lt;br /&gt;
//add the links to the external files into the head of the webpage (note the &#039;administrator&#039; in the path, which is not nescessary if you are in the frontend)&lt;br /&gt;
$document =&amp;amp; JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.queue.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/fileprogress.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/handlers.js&#039;);&lt;br /&gt;
$document-&amp;gt;addStyleSheet($host.&#039;administrator/components/com_mycomponent/swfupload/default.css&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
That is the external files part done. We still have to add in the head javascript, and the body html.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Part 3: Adding The Head Javascript ===&lt;br /&gt;
&lt;br /&gt;
Head javascript part:&lt;br /&gt;
The javascript below is almost the same as the javascript from the simple demo, the few modifications are commented. It is nescessary to read through it and change the parts (such as task) that are relevant to your component.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//when we send the files for upload, we have to tell Joomla our session, or we will get logged out &lt;br /&gt;
$session = &amp;amp; JFactory::getSession();&lt;br /&gt;
		&lt;br /&gt;
$swfUploadHeadJs =&#039;&lt;br /&gt;
var swfu;&lt;br /&gt;
&lt;br /&gt;
window.onload = function()&lt;br /&gt;
{&lt;br /&gt;
			&lt;br /&gt;
var settings = &lt;br /&gt;
{&lt;br /&gt;
        //this is the path to the flash file, you need to put your components name into it&lt;br /&gt;
	flash_url : &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.swf&amp;quot;,&lt;br /&gt;
	&lt;br /&gt;
        //we can not put any vars into the url for complicated reasons, but we can put them into the post...&lt;br /&gt;
        upload_url: &amp;quot;index.php&amp;quot;,&lt;br /&gt;
	post_params: &lt;br /&gt;
	{&lt;br /&gt;
		&amp;quot;option&amp;quot; : &amp;quot;com_mycomponent&amp;quot;,&lt;br /&gt;
		&amp;quot;controller&amp;quot; : &amp;quot;mycontroller&amp;quot;,&lt;br /&gt;
		&amp;quot;task&amp;quot; : &amp;quot;mytask&amp;quot;,&lt;br /&gt;
		&amp;quot;id&amp;quot; : &amp;quot;&#039;.$myItemObject-&amp;gt;id.&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;&#039;.$session-&amp;gt;getName().&#039;&amp;quot; : &amp;quot;&#039;.$session-&amp;gt;getId().&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;format&amp;quot; : &amp;quot;raw&amp;quot;&lt;br /&gt;
	}, &lt;br /&gt;
        //you need to put the session and the &#039;format raw&#039; in there, the other ones are what you would normally put in the url&lt;br /&gt;
	file_size_limit : &amp;quot;5 MB&amp;quot;,&lt;br /&gt;
        //client side file chacking is for usability only, you need to check server side for security&lt;br /&gt;
	file_types : &amp;quot;*.jpg;*.jpeg;*.gif;*.png&amp;quot;,&lt;br /&gt;
	file_types_description : &amp;quot;All Files&amp;quot;,&lt;br /&gt;
	file_upload_limit : 100,&lt;br /&gt;
	file_queue_limit : 100,&lt;br /&gt;
	custom_settings : &lt;br /&gt;
	{&lt;br /&gt;
		progressTarget : &amp;quot;fsUploadProgress&amp;quot;,&lt;br /&gt;
		cancelButtonId : &amp;quot;btnCancel&amp;quot;&lt;br /&gt;
	},&lt;br /&gt;
	debug: false,&lt;br /&gt;
&lt;br /&gt;
	// Button settings&lt;br /&gt;
	button_image_url: &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/images/TestImageNoText_65x29.png&amp;quot;,&lt;br /&gt;
	button_width: &amp;quot;85&amp;quot;,&lt;br /&gt;
	button_height: &amp;quot;29&amp;quot;,&lt;br /&gt;
	button_placeholder_id: &amp;quot;spanButtonPlaceHolder&amp;quot;,&lt;br /&gt;
	button_text: \&#039;&amp;lt;span class=&amp;quot;theFont&amp;quot;&amp;gt;Choose Files&amp;lt;/span&amp;gt;\&#039;,&lt;br /&gt;
	button_text_style: &amp;quot;.theFont { font-size: 13; }&amp;quot;,&lt;br /&gt;
	button_text_left_padding: 5,&lt;br /&gt;
	button_text_top_padding: 5,&lt;br /&gt;
				&lt;br /&gt;
	// The event handler functions are defined in handlers.js&lt;br /&gt;
	file_queued_handler : fileQueued,&lt;br /&gt;
	file_queue_error_handler : fileQueueError,&lt;br /&gt;
	file_dialog_complete_handler : fileDialogComplete,&lt;br /&gt;
	upload_start_handler : uploadStart,&lt;br /&gt;
	upload_progress_handler : uploadProgress,&lt;br /&gt;
	upload_error_handler : uploadError,&lt;br /&gt;
	upload_success_handler : uploadSuccess,&lt;br /&gt;
	upload_complete_handler : uploadComplete,&lt;br /&gt;
	queue_complete_handler : queueComplete	// Queue plugin event&lt;br /&gt;
};&lt;br /&gt;
swfu = new SWFUpload(settings);&lt;br /&gt;
};&lt;br /&gt;
	     &lt;br /&gt;
&#039;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want more info on what each paramater is, have a look at the swfupload docs:&lt;br /&gt;
http://demo.swfupload.org/Documentation/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 4: Adding The Body HTML ===&lt;br /&gt;
&lt;br /&gt;
We still have to add in our body HTML, in you tmpl/default.php file add in:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;swfuploader&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;form id=&amp;quot;form1&amp;quot; action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; enctype=&amp;quot;multipart/form-data&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
			&amp;lt;div class=&amp;quot;fieldset flash&amp;quot; id=&amp;quot;fsUploadProgress&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;span class=&amp;quot;legend&amp;quot;&amp;gt;Upload Queue&amp;lt;/span&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div id=&amp;quot;divStatus&amp;quot;&amp;gt;0 Files Uploaded&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;div&amp;gt;&lt;br /&gt;
				&amp;lt;span id=&amp;quot;spanButtonPlaceHolder&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
				&amp;lt;input id=&amp;quot;btnCancel&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Cancel All Uploads&amp;quot; onclick=&amp;quot;swfu.cancelQueue();&amp;quot; disabled=&amp;quot;disabled&amp;quot; style=&amp;quot;margin-left: 2px; font-size: 8pt; height: 29px;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
	&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all has gone well, you will be able to upload files to your components script, although nothing will happen on the server as there is no PHP to recieve the image.&lt;br /&gt;
&lt;br /&gt;
===  Part 5: Recieveing The File With PHP ===&lt;br /&gt;
&lt;br /&gt;
It is worth noting that allowing users to upload files to the server is possibly the most dangerous thing to do in terms of security, and if someone with malicious intentions manages to upload a php file to your server, then they can easily take control of the site.&lt;br /&gt;
&lt;br /&gt;
It is recommeneded you do some reading on file upload security. This is a good start:&lt;br /&gt;
&lt;br /&gt;
http://www.scanit.be/uploads/php-file-upload.pdf&lt;br /&gt;
&lt;br /&gt;
And there are many other good resources on the internet. It is important you understand how file upload security works, rather than copying and pasting some code that checks the MIME type, and assuming the script is safe.&lt;br /&gt;
&lt;br /&gt;
Here is some example PHP that will check if the file is an image, and upload it. It is not an exhaustive example of security checking, but it is a good start:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//import joomlas filesystem functions, we will do all the filewriting with joomlas functions,&lt;br /&gt;
//so if the ftp layer is on, joomla will write with that, not the apache user, which might&lt;br /&gt;
//not have the correct permissions&lt;br /&gt;
jimport(&#039;joomla.filesystem.file&#039;);&lt;br /&gt;
jimport(&#039;joomla.filesystem.folder&#039;);&lt;br /&gt;
		&lt;br /&gt;
//this is the name of the field in the html form, filedata is the default name for swfupload&lt;br /&gt;
//so we will leave it as that&lt;br /&gt;
$fieldName = &#039;Filedata&#039;;&lt;br /&gt;
&lt;br /&gt;
//any errors the server registered on uploading&lt;br /&gt;
$fileError = $_FILES[$fieldName][&#039;error&#039;];&lt;br /&gt;
if ($fileError &amp;gt; 0) &lt;br /&gt;
{&lt;br /&gt;
        switch ($fileError) &lt;br /&gt;
	{&lt;br /&gt;
        case 1:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN PHP INI ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 2:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN HTML FORM ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 3:&lt;br /&gt;
        echo JText::_( &#039;ERROR PARTIAL UPLOAD&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 4:&lt;br /&gt;
        echo JText::_( &#039;ERROR NO FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check for filesize&lt;br /&gt;
$fileSize = $_FILES[$fieldName][&#039;size&#039;];&lt;br /&gt;
if($fileSize &amp;gt; 2000000)&lt;br /&gt;
{&lt;br /&gt;
    echo JText::_( &#039;FILE BIGGER THAN 2MB&#039; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check the file extension is ok&lt;br /&gt;
$fileName = $_FILES[$fieldName][&#039;name&#039;];&lt;br /&gt;
$uploadedFileNameParts = explode(&#039;.&#039;,$fileName);&lt;br /&gt;
$uploadedFileExtension = array_pop($uploadedFileNameParts);&lt;br /&gt;
&lt;br /&gt;
$okFileExtensions = &#039;jpeg,jpg,png,gif&#039;;&lt;br /&gt;
$validFileExts = explode(&amp;quot;,&amp;quot;, $extAccept);&lt;br /&gt;
&lt;br /&gt;
//assume the extension is false until we know its ok&lt;br /&gt;
$extOk = false;&lt;br /&gt;
&lt;br /&gt;
//go through every ok extension, if the ok extension matches the file extension (case insensitive)&lt;br /&gt;
//then the file extension is ok&lt;br /&gt;
foreach($validFileExts as $key =&amp;gt; $value)&lt;br /&gt;
{&lt;br /&gt;
	if( preg_match(&amp;quot;/$value/i&amp;quot;, $uploadedFileExtension ) )&lt;br /&gt;
	{&lt;br /&gt;
		$extOk = true;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ($extOk == false) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID EXTENSION&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
//the name of the file in PHP&#039;s temp directory that we are going to move to our folder&lt;br /&gt;
$fileTemp = $_FILES[$fieldName][&#039;tmp_name&#039;];&lt;br /&gt;
		&lt;br /&gt;
//for security purposes, we will also do a getimagesize on the temp file (before we have moved it &lt;br /&gt;
//to the folder) to check the MIME type of the file, and whether it has a width and height&lt;br /&gt;
$imageinfo = getimagesize($fileTemp);&lt;br /&gt;
		&lt;br /&gt;
//we are going to define what file extensions/MIMEs are ok, and only let these ones in (whitelisting), rather than try to scan for bad&lt;br /&gt;
//types, where we might miss one (whitelisting is always better than blacklisting) &lt;br /&gt;
$okMIMETypes = &#039;image/jpeg,image/pjpeg,image/png,imagex-png,image/gif&#039;;&lt;br /&gt;
$validFileTypes = explode(&amp;quot;,&amp;quot;, $accept);		&lt;br /&gt;
&lt;br /&gt;
//if the temp file does not have a width or a height, or it has a non ok MIME, return&lt;br /&gt;
if( !is_int($imageinfo[0]) || !is_int($imageinfo[1]) ||  !in_array($imageinfo[&#039;mime&#039;], $validFileTypes) )&lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID FILETYPE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//lose any special characters in the filename&lt;br /&gt;
$fileName = ereg_replace(&amp;quot;[^A-Za-z0-9.]&amp;quot;, &amp;quot;-&amp;quot;, $fileName);&lt;br /&gt;
&lt;br /&gt;
//always use constants when making file paths, to avoid the possibilty of remote file inclusion&lt;br /&gt;
$uploadPath = JPATH_SITE.DS.&#039;images&#039;.DS.&#039;stories&#039;.DS.$fileName;&lt;br /&gt;
&lt;br /&gt;
if(!JFile::upload($fileTemp, $uploadPath)) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;ERROR MOVING FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all want well the uploaded files will be in the images/stories folder.&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15407</id>
		<title>Archived:Creating a file uploader in your component</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_file_uploader_in_your_component&amp;diff=15407"/>
		<updated>2009-08-13T23:32:46Z</updated>

		<summary type="html">&lt;p&gt;Matt nz: New page: == Creating a file uploader in your component: Method 1, SWFUpload ==  === Part 1: Introduction ===  SWFUpload is a free open source multiple file uploader available for download from http...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating a file uploader in your component: Method 1, SWFUpload ==&lt;br /&gt;
&lt;br /&gt;
=== Part 1: Introduction ===&lt;br /&gt;
&lt;br /&gt;
SWFUpload is a free open source multiple file uploader available for download from http://swfupload.org/&lt;br /&gt;
&lt;br /&gt;
A demo of swfupload is available here: http://demo.swfupload.org/v220/simpledemo/index.php&lt;br /&gt;
&lt;br /&gt;
The standard way to upload a file is with a HTML form. This works great if you are uploading one file, but browsers do not let you select and upload more than one file at a time.&lt;br /&gt;
&lt;br /&gt;
The most common way of selecting multiple files for upload is to use flash and javascript. The flash part of the script opens up a selct file dialog where multiple files can be selected, and the flash/javascript sends each file, and recieves the response from the server.&lt;br /&gt;
&lt;br /&gt;
The most popular scripts used to do this are SWFUpload and Fancy upload (http://digitarald.de/project/fancyupload/). The flash uploader in Joomla&#039;s media manager is based on Fancy Upload version 1.0. As Fancy upload 2.0 and 3.0 use mootools 1.2, and Joomla 1.5 uses mootools 1.11, we can not use Fancy Upload 2.0/3.0 in the admin pages of Joomla. Fancy Upload 1.0 could be used, but it is not updated or supported anymore.&lt;br /&gt;
&lt;br /&gt;
SWFUpload does not use Mootools or Jquery. Because of this it will likely work on any page with Mootools 1.11 (Joomla 1.5), or Mootools 1.2 (Joomla 1.6). Therefore we will be using SWFUpload in this article.&lt;br /&gt;
&lt;br /&gt;
Download ths latest version of SWFUpload from the download page (http://code.google.com/p/swfupload/). Download the SWFUpload v2.2.0.1 Samples.zip file.&lt;br /&gt;
&lt;br /&gt;
Inside the file there will be a demos folder, and inside that a simpledemo folder. This is the example we are going to integrate into a Joomla component.&lt;br /&gt;
&lt;br /&gt;
This tutorial assumes you have followed the http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 tutorial and are familiar with Joomla&#039;s MVC structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Part 2: Adding The External Javascript ===&lt;br /&gt;
&lt;br /&gt;
We need to add in the external links in the head of the document, put some javascript into the head of the doc, and put some HTML in our body.&lt;br /&gt;
&lt;br /&gt;
If you look at the simpledemo/index.php page you will see links to 5 files in the head of the page.&lt;br /&gt;
&lt;br /&gt;
Make a folder within the root of your components folder called swfupload, copy the ../css/default.css, ../swfupload/swfupload.js, js/swfupload.queue.js, js/fileprogress.js and js/handlers.js files into this folder.&lt;br /&gt;
&lt;br /&gt;
We also need to copy the ../swfupload/swfupload.swf and images/TestImageNoText_65x29.png files into this folder.&lt;br /&gt;
&lt;br /&gt;
Within your view.html.php file add in the following code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//get the hosts name&lt;br /&gt;
jimport(&#039;joomla.environment.uri&#039; );&lt;br /&gt;
$host = JURI::root();&lt;br /&gt;
&lt;br /&gt;
//add the links to the external files into the head of the webpage (note the &#039;administrator&#039; in the path, which is not nescessary if you are in the frontend)&lt;br /&gt;
$document =&amp;amp; JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.queue.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/fileprogress.js&#039;);&lt;br /&gt;
$document-&amp;gt;addScript($host.&#039;administrator/components/com_mycomponent/swfupload/handlers.js&#039;);&lt;br /&gt;
$document-&amp;gt;addStyleSheet($host.&#039;administrator/components/com_mycomponent/swfupload/default.css&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
That is the external files part done. We still have to add in the head javascript, and the body html.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Part 3: Adding The Head Javascript ===&lt;br /&gt;
&lt;br /&gt;
Head javascript part:&lt;br /&gt;
The javascript below is almost the same as the javascript from the simple demo, the few modifications are commented. It is nescessary to read through it and change the parts (such as task) that are relevant to your component.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//when we send the files for upload, we have to tell Joomla our session, or we will get logged out &lt;br /&gt;
$session = &amp;amp; JFactory::getSession();&lt;br /&gt;
		&lt;br /&gt;
$swfUploadHeadJs =&#039;&lt;br /&gt;
var swfu;&lt;br /&gt;
&lt;br /&gt;
window.onload = function()&lt;br /&gt;
{&lt;br /&gt;
			&lt;br /&gt;
var settings = &lt;br /&gt;
{&lt;br /&gt;
        //this is the path to the flash file, you need to put your components name into it&lt;br /&gt;
	flash_url : &amp;quot;&#039;.$host.&#039;administrator/components/com_mycomponent/swfupload/swfupload.swf&amp;quot;,&lt;br /&gt;
	&lt;br /&gt;
        //we can not put any vars into the url for complicated reasons, but we can put them into the post...&lt;br /&gt;
        upload_url: &amp;quot;index.php&amp;quot;,&lt;br /&gt;
	post_params: &lt;br /&gt;
	{&lt;br /&gt;
		&amp;quot;option&amp;quot; : &amp;quot;com_mycomponent&amp;quot;,&lt;br /&gt;
		&amp;quot;controller&amp;quot; : &amp;quot;mycontroller&amp;quot;,&lt;br /&gt;
		&amp;quot;task&amp;quot; : &amp;quot;mytask&amp;quot;,&lt;br /&gt;
		&amp;quot;id&amp;quot; : &amp;quot;&#039;.$myItemObject-&amp;gt;id.&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;&#039;.$session-&amp;gt;getName().&#039;&amp;quot; : &amp;quot;&#039;.$session-&amp;gt;getId().&#039;&amp;quot;,&lt;br /&gt;
		&amp;quot;format&amp;quot; : &amp;quot;raw&amp;quot;&lt;br /&gt;
	}, &lt;br /&gt;
        //you need to put the session and the &#039;format raw&#039; in there, the other ones are what you would normally put in the url&lt;br /&gt;
	file_size_limit : &amp;quot;5 MB&amp;quot;,&lt;br /&gt;
        //client side file chacking is for usability only, you need to check server side for security&lt;br /&gt;
	file_types : &amp;quot;*.jpg;*.jpeg;*.gif;*.png&amp;quot;,&lt;br /&gt;
	file_types_description : &amp;quot;All Files&amp;quot;,&lt;br /&gt;
	file_upload_limit : 100,&lt;br /&gt;
	file_queue_limit : 100,&lt;br /&gt;
	custom_settings : &lt;br /&gt;
	{&lt;br /&gt;
		progressTarget : &amp;quot;fsUploadProgress&amp;quot;,&lt;br /&gt;
		cancelButtonId : &amp;quot;btnCancel&amp;quot;&lt;br /&gt;
	},&lt;br /&gt;
	debug: false,&lt;br /&gt;
&lt;br /&gt;
	// Button settings&lt;br /&gt;
	button_image_url: &amp;quot;&#039;.$host.&#039;administrator/components/com_igallery/swfupload/images/TestImageNoText_65x29.png&amp;quot;,&lt;br /&gt;
	button_width: &amp;quot;85&amp;quot;,&lt;br /&gt;
	button_height: &amp;quot;29&amp;quot;,&lt;br /&gt;
	button_placeholder_id: &amp;quot;spanButtonPlaceHolder&amp;quot;,&lt;br /&gt;
	button_text: \&#039;&amp;lt;span class=&amp;quot;theFont&amp;quot;&amp;gt;Choose Files&amp;lt;/span&amp;gt;\&#039;,&lt;br /&gt;
	button_text_style: &amp;quot;.theFont { font-size: 13; }&amp;quot;,&lt;br /&gt;
	button_text_left_padding: 5,&lt;br /&gt;
	button_text_top_padding: 5,&lt;br /&gt;
				&lt;br /&gt;
	// The event handler functions are defined in handlers.js&lt;br /&gt;
	file_queued_handler : fileQueued,&lt;br /&gt;
	file_queue_error_handler : fileQueueError,&lt;br /&gt;
	file_dialog_complete_handler : fileDialogComplete,&lt;br /&gt;
	upload_start_handler : uploadStart,&lt;br /&gt;
	upload_progress_handler : uploadProgress,&lt;br /&gt;
	upload_error_handler : uploadError,&lt;br /&gt;
	upload_success_handler : uploadSuccess,&lt;br /&gt;
	upload_complete_handler : uploadComplete,&lt;br /&gt;
	queue_complete_handler : queueComplete	// Queue plugin event&lt;br /&gt;
};&lt;br /&gt;
swfu = new SWFUpload(settings);&lt;br /&gt;
};&lt;br /&gt;
	     &lt;br /&gt;
&#039;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want more info on what each paramater is, have a look at the swfupload docs:&lt;br /&gt;
http://demo.swfupload.org/Documentation/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Part 4: Adding The Body HTML ===&lt;br /&gt;
&lt;br /&gt;
We still have to add in our body HTML, in you tmpl/default.php file add in:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;swfuploader&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;form id=&amp;quot;form1&amp;quot; action=&amp;quot;index.php&amp;quot; method=&amp;quot;post&amp;quot; enctype=&amp;quot;multipart/form-data&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;fieldset class=&amp;quot;adminform&amp;quot;&amp;gt;&lt;br /&gt;
		&lt;br /&gt;
			&amp;lt;div class=&amp;quot;fieldset flash&amp;quot; id=&amp;quot;fsUploadProgress&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;span class=&amp;quot;legend&amp;quot;&amp;gt;Upload Queue&amp;lt;/span&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div id=&amp;quot;divStatus&amp;quot;&amp;gt;0 Files Uploaded&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;div&amp;gt;&lt;br /&gt;
				&amp;lt;span id=&amp;quot;spanButtonPlaceHolder&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
				&amp;lt;input id=&amp;quot;btnCancel&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Cancel All Uploads&amp;quot; onclick=&amp;quot;swfu.cancelQueue();&amp;quot; disabled=&amp;quot;disabled&amp;quot; style=&amp;quot;margin-left: 2px; font-size: 8pt; height: 29px;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
	&amp;lt;/fieldset&amp;gt;&lt;br /&gt;
	&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all has gone well, you will be able to upload files to your components script, although nothing will happen on the server as there is no PHP to recieve the image.&lt;br /&gt;
&lt;br /&gt;
===  Part 5: Recieveing The File With PHP ===&lt;br /&gt;
&lt;br /&gt;
It is worth noting that allowing users to upload files to the server is possibly the most dangerous thing to do in terms of security, and if someone with malicious intentions manages to upload a php file to your server, then they can easily take control of the site.&lt;br /&gt;
&lt;br /&gt;
It is recommeneded you do some reading on file upload security. This is a good start:&lt;br /&gt;
&lt;br /&gt;
http://www.scanit.be/uploads/php-file-upload.pdf&lt;br /&gt;
&lt;br /&gt;
And there are many other good resources on the internet. It is important you understand how file upload security works, rather than copying and pasting some code that checks the MIME type, and assuming the script is safe.&lt;br /&gt;
&lt;br /&gt;
Here is some example PHP that will check if the file is an image, and upload it. It is not an exhaustive example of security checking, but it is a good start:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
//import joomlas filesystem functions, we will do all the filewriting with joomlas functions,&lt;br /&gt;
//so if the ftp layer is on, joomla will write with that, not the apache user, which might&lt;br /&gt;
//not have the correct permissions&lt;br /&gt;
jimport(&#039;joomla.filesystem.file&#039;);&lt;br /&gt;
jimport(&#039;joomla.filesystem.folder&#039;);&lt;br /&gt;
		&lt;br /&gt;
//this is the name of the field in the html form, filedata is the default name for swfupload&lt;br /&gt;
//so we will leave it as that&lt;br /&gt;
$fieldName = &#039;Filedata&#039;;&lt;br /&gt;
&lt;br /&gt;
//any errors the server registered on uploading&lt;br /&gt;
$fileError = $_FILES[$fieldName][&#039;error&#039;];&lt;br /&gt;
if ($fileError &amp;gt; 0) &lt;br /&gt;
{&lt;br /&gt;
        switch ($fileError) &lt;br /&gt;
	{&lt;br /&gt;
        case 1:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN PHP INI ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 2:&lt;br /&gt;
        echo JText::_( &#039;FILE TO LARGE THAN HTML FORM ALLOWS&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 3:&lt;br /&gt;
        echo JText::_( &#039;ERROR PARTIAL UPLOAD&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
        case 4:&lt;br /&gt;
        echo JText::_( &#039;ERROR NO FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check for filesize&lt;br /&gt;
$fileSize = $_FILES[$fieldName][&#039;size&#039;];&lt;br /&gt;
if($fileSize &amp;gt; 2000000)&lt;br /&gt;
{&lt;br /&gt;
    echo JText::_( &#039;FILE BIGGER THAN 2MB&#039; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//check the file extension is ok&lt;br /&gt;
$fileName = $_FILES[$fieldName][&#039;name&#039;];&lt;br /&gt;
$uploadedFileNameParts = explode(&#039;.&#039;,$fileName);&lt;br /&gt;
$uploadedFileExtension = array_pop($uploadedFileNameParts);&lt;br /&gt;
&lt;br /&gt;
$okFileExtensions = &#039;jpeg,jpg,png,gif&#039;;&lt;br /&gt;
$validFileExts = explode(&amp;quot;,&amp;quot;, $extAccept);&lt;br /&gt;
&lt;br /&gt;
//assume the extension is false until we know its ok&lt;br /&gt;
$extOk = false;&lt;br /&gt;
&lt;br /&gt;
//go through every ok extension, if the ok extension matches the file extension (case insensitive)&lt;br /&gt;
//then the file extension is ok&lt;br /&gt;
foreach($validFileExts as $key =&amp;gt; $value)&lt;br /&gt;
{&lt;br /&gt;
	if( preg_match(&amp;quot;/$value/i&amp;quot;, $uploadedFileExtension ) )&lt;br /&gt;
	{&lt;br /&gt;
		$extOk = true;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ($extOk == false) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID EXTENSION&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
//the name of the file in PHP&#039;s temp directory that we are going to move to our folder&lt;br /&gt;
$fileTemp = $_FILES[$fieldName][&#039;tmp_name&#039;];&lt;br /&gt;
		&lt;br /&gt;
//for security purposes, we will also do a getimagesize on the temp file (before we have moved it &lt;br /&gt;
//to the folder) to check the MIME type of the file, and whether it has a width and height&lt;br /&gt;
$imageinfo = getimagesize($fileTemp);&lt;br /&gt;
		&lt;br /&gt;
//we are going to define what file extensions/MIMEs are ok, and only let these ones in (whitelisting), rather than try to scan for bad&lt;br /&gt;
//types, where we might miss one (whitelisting is always better than blacklisting) &lt;br /&gt;
$okMIMETypes = &#039;image/jpeg,image/pjpeg,image/png,imagex-png,image/gif&#039;;&lt;br /&gt;
$validFileTypes = explode(&amp;quot;,&amp;quot;, $accept);		&lt;br /&gt;
&lt;br /&gt;
//if the temp file does not have a width or a height, or it has a non ok MIME, return&lt;br /&gt;
if( !is_int($imageinfo[0]) || !is_int($imageinfo[1]) ||  !in_array($imageinfo[&#039;mime&#039;], $validFileTypes) )&lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;INVALID FILETYPE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//lose any special characters in the filename&lt;br /&gt;
$fileName = ereg_replace(&amp;quot;[^A-Za-z0-9.]&amp;quot;, &amp;quot;-&amp;quot;, $fileName);&lt;br /&gt;
&lt;br /&gt;
//always use constants when making file paths, to avoid the possibilty of remote file inclusion&lt;br /&gt;
$uploadPath = JPATH_SITE.DS.&#039;images&#039;.DS.&#039;stories&#039;.DS.$fileName;&lt;br /&gt;
&lt;br /&gt;
if(!JFile::upload($fileTemp, $uploadPath)) &lt;br /&gt;
{&lt;br /&gt;
	echo JText::_( &#039;ERROR MOVING FILE&#039; );&lt;br /&gt;
        return;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all want well the uploaded files will be in the images/stories folder.&lt;/div&gt;</summary>
		<author><name>Matt nz</name></author>
	</entry>
</feed>