element_id = $element_id; $this->swf_name = $swf_path; $this->target = $target; $this->pass_vars = array(); $this->properties = array( 'bg_color' => '0xFFFFFF', 'set_width' => 415, 'set_height' => 54, 'valid_extensions' => '*.jpg,*.pdf', 'extensions_mod' => '*.jpg;*.pdf' ); //valid properties: max_file_size, max_files, callback, style, valid_extensions, click_text, uploading_text, complete_text, pending_text, max_text, auto_clear, allow_clear, allow_cancel, set_width, set_height, bg_color, bar_bg_color, divider_color, button_title_color, button_color, button_shadow, txt_title_color, txt_filename_color, txt_percent_color, txt_progress_color } /********************************************************************************************* FUNCTION set Parameters: $property - the name of the property $value - the desired value of the property Description: Creates the FlashUploader object *********************************************************************************************/ function set($property, $value) { $this->properties[$property] = $value; if($property == 'valid_extensions') $this->properties['extensions_mod'] = implode(';', explode(',', $this->properties['valid_extensions'])); } /********************************************************************************************* FUNCTION pass_var Parameters: $name - the name of the variable to pass $value - the desired value of the variable Description: Creates a variable to pass to the PHP upload file ($target) via GET *********************************************************************************************/ function pass_var($name, $value) { $this->pass_vars[$name] = $value; } /********************************************************************************************* FUNCTION property_str Parameters: None Description: Generates the string of property values to be passed to the uploader *********************************************************************************************/ function property_str() { $string = '&'; foreach($this->properties as $i=>$p) $string .= $i.'='.$p.'&'; return $string; } /********************************************************************************************* FUNCTION var_string Parameters: None Description: Generates the string of variables to be passed to the PHP upload file ($target) via GET *********************************************************************************************/ function var_string() { $string = 'vars='; foreach($this->pass_vars as $index=>$pv) $string .= $index.'*!#'.$pv.'#!*'; return $string; } /********************************************************************************************* FUNCTION display Parameters: None Description: Displays the FlashUploader *********************************************************************************************/ function display() { ob_start(); ?>