0

hi

i have a site runnig php pro bid solution.
when a user uploads a img with more that 2000 or 2500 pixels more or less, it retrieves a error box saying just "undefined". how can i solve this??

cheers

3
Contributors
5
Replies
11
Views
5 Years
Discussion Span
Last Post by sanzhar.ismailov.7
0

Chances are it is trying to show a value from a property of a JavaScript object that is undefined. Without seeing code it's not exactly easy to help you.

0

Chances are it is trying to show a value from a property of a JavaScript object that is undefined. Without seeing code it's not exactly easy to help you.

<input type="file" name="item_file_upload_1" id="item_file_upload_1" style="width: 250px;" onchange="upload_media_async(ad_create_form, 1, 
	      						this.form.item_file_upload_1, 
	      						document.getElementById('item_file_url_1').value, 
	      						document.getElementById('item_file_embed_1').value, 
	      						document.getElementById('nb_uploads_1').value, 
	      						10, 
	      						'A_130097');">
function upload_manager($variables_array, $media_type = 1, $form_name = null, $manager_display = false, $new_table = false, $box_title = true, $display_fee = null, $reverse_dd = false)
	{
		(string) $display_output = null;
		/**
		 * Media Types:
		 * 1 -> image
		 * 2 -> video
		 * 3 -> digital download
		 *
		 * if $no_display = true, then display only hidden fields. Otherwise display the actual download manager
		 */

		if (!$manager_display)
		{
			$display_output .= '<div id="hidden_media_boxes">';
			if (is_array($variables_array['ad_image']))
			{
				foreach ($variables_array['ad_image'] as $ad_media)
				{
					if (!empty($ad_media))
					{
						$display_output .= '<input type="hidden" id="' . $this->box_id($ad_media, 'hidden_') . '" name="ad_image[]" value="' . $ad_media . '"> ';
					}
				}
			}
			
			if (is_array($variables_array['ad_video']))
			{
				foreach ($variables_array['ad_video'] as $ad_media)
				{
					if (!empty($ad_media))
					{
						$display_output .= '<input type="hidden" id="' . $this->box_id($ad_media, 'hidden_') . '" name="ad_video[]" value="' . $ad_media . '"> ';
					}
				}
			}
						
			if (is_array($variables_array['ad_dd']))
			{
				if ($this->setts['dd_enabled'])
				{
					foreach ($variables_array['ad_dd'] as $ad_media)
					{
						if (!empty($ad_media))
						{
							$ad_media = str_replace($this->setts['dd_folder'], '', $ad_media);
							$display_output .= '<input type="hidden" id="' . $this->box_id($ad_media, 'hidden_') . '" name="ad_dd[]" value="' . $ad_media . '"> ';
						}
					}
				}
			}
			$display_output .= '</div>';
		}
		else
		{
			if ($this->show_free_images)
			{
				$this->fees = new fees();
				$this->fees->setts = &$this->setts;
				
				$this->fees->set_fees(null, $variables_array['category_id']);
			}
			
			if ($media_type == 1) /* image upload manager */
			{
				$nb_uploads = $this->count_contents($variables_array['ad_image']);
				$submit_btn_status = ($nb_uploads<$this->setts['max_images']) ? '' : 'disabled';
				$max_media = $this->setts['max_images'];
				$media_name = 'ad_image';

				$msg_upload_box_title = MSG_AD_IMAGES;
				$msg_media = MSG_IMAGES;
				$msg_uploaded_media = MSG_UPLOADED_IMAGES;
				$msg_uploaded_media_expl = MSG_UPLOADED_IMAGES_EXPL;
				
				if ($this->show_free_images)
				{
					$fee_message = ($this->fees->min_charged_image) ? ('<br>' . MSG_FIRST . ' ' . $this->fees->min_charged_image . ' ' . MSG_IMAGES . ' ' . MSG_WILL_BE_FREE) : '';
				}
			}
			else if ($media_type == 2) /* video upload manager */
			{
				$nb_uploads = $this->count_contents($variables_array['ad_video']);
				$submit_btn_status = ($nb_uploads<$this->setts['max_media']) ? '' : 'disabled';
				$max_media = $this->setts['max_media'];
				$media_name = 'ad_video';

				$msg_upload_box_title = MSG_AD_MEDIA;
				$msg_media = MSG_VIDEOS;
				$msg_uploaded_media = MSG_UPLOADED_VIDEOS;
				$msg_uploaded_media_expl = MSG_UPLOADED_VIDEOS_EXPL;

				if ($this->show_free_images)
				{
					$fee_message = ($this->fees->min_charged_video) ? ('<br>' . MSG_FIRST . ' ' . $this->fees->min_charged_video . ' ' . MSG_VIDEOS_SIMPLE . ' ' . MSG_WILL_BE_FREE) : '';
				}
			}
			else if ($media_type == 3) /* digital media upload manager */
			{
				$nb_uploads = $this->count_contents($variables_array['ad_dd']);
				$submit_btn_status = ($nb_uploads<$this->setts['max_dd']) ? '' : 'disabled';
				$max_media = $this->setts['max_dd'];
				$media_name = 'ad_dd';

				$msg_upload_box_title = ($reverse_dd) ? MSG_ADDITIONAL_FILES : MSG_DIGITAL_GOODS;
				$msg_media = ($reverse_dd) ? MSG_REVERSE_DD_FILES : MSG_FILES;
				$msg_uploaded_media = MSG_UPLOADED_FILES;
				$msg_uploaded_media_expl = MSG_UPLOADED_FILES_EXPL;
				
				## uncomment the line below if you dont want to allow remote files to be added for digital downloads
				//$this->upload_url = false; 
			}

			if ($new_table)
			{
				$display_output = '<table width="100%" border="0" cellpadding="3" cellspacing="2"> ';
			}

			if ($box_title)
			{
				$display_output .= '<tr class="c4"> '.
	      		'	<td colspan="3"><a href="' . $anchor_name . '"></a>' . $msg_upload_box_title . '</td> '.
	   			'</tr> '.
	   			'<tr class="c5"> '.
	      		'	<td><img src="themes/' . $this->setts['default_theme'] . '/img/pixel.gif" width="150" height="1"></td> '.
	      		'	<td colspan="2"><img src="themes/' . $this->setts['default_theme'] . '/img/pixel.gif" width="1" height="1"></td> '.
	   			'</tr> ';
			}

   		$display_output .= '<tr class="c1"> '.
   			'	<input type="hidden" name="nb_uploads_' . $media_type . '" id="nb_uploads_' . $media_type . '" value="' . $nb_uploads . '">'.
      		'	<td align="right" nowrap>' . MSG_UPLOAD_FILE . '</td> '.
      		'	<td>
      				<div id="div_file_' . $media_type . '">
      					<input type="file" name="item_file_upload_' . $media_type . '" id="item_file_upload_' . $media_type . '" style="width: 250px;" 
	      					onchange="upload_media_async(' . $form_name . ', ' . $media_type . ', 
	      						this.form.item_file_upload_' . $media_type . ', 
	      						document.getElementById(\'item_file_url_' . $media_type . '\').value, 
	      						document.getElementById(\'item_file_embed_' . $media_type . '\').value, 
	      						document.getElementById(\'nb_uploads_' . $media_type . '\').value, 
	      						' . $max_media . ', 
	      						\'' . $this->set_upload_id($variables_array) . '\');" ' . $submit_btn_status . ' />
	      			</div>
	      		</td> '.
      		'	<td></td>'.
   			'</tr> ';
   		
   		$upload_btn_content = '<td ' . (($this->upload_url) ? (($media_type == 2 && $this->setts['enable_embedded_media']) ? 'rowspan="2"' : 'rowspan="1"') : '') . ' width="100%"> '.
      		'	<input type="button" name="btn_upload_file" id="btn_upload_' . $media_type . '" value="' . GMSG_UPLOAD . '" '.
      		'		onclick="upload_media_async(' . $form_name . ', ' . $media_type . ', 
      					this.form.item_file_upload_' . $media_type . ', 
      					document.getElementById(\'item_file_url_' . $media_type . '\').value, 
      					document.getElementById(\'item_file_embed_' . $media_type . '\').value, 
      					document.getElementById(\'nb_uploads_' . $media_type . '\').value, 
      					' . $max_media . ', 
      					\'' . $this->set_upload_id($variables_array) . '\');" ' . $submit_btn_status . ' /> '.
      		'	</td> ';
   			
      	$add_upload_btn = false;
   		if ($this->upload_url)
   		{
   			$add_upload_btn = true;
	   		$display_output .= '<tr class="c2"> '.
	      		'	<td align="right" nowrap>' . MSG_ENTER_FILE_URL . '</td> '.
	      		'	<td>
	      				<input type="text" name="item_file_url_' . $media_type . '" id="item_file_url_' . $media_type . '" style="width: 250px;" /></td> '.    
	      		$upload_btn_content .  		
	   			'</tr> ';
   		}
   		else 
   		{
				$display_output .= '<input type="hidden" name="item_file_url_' . $media_type . '" id="item_file_url_' . $media_type . '" value="" />';   			
   		}
   		
   		if ($media_type == 2 && $this->setts['enable_embedded_media'])
   		{
   			$add_upload_btn = true;
	   		$display_output .= '<tr class="c2"> '.
	   			//'	<input type="hidden" name="embedded_code" value="1">'.
	      		'	<td align="right" nowrap>' . MSG_ENTER_EMBEDDED_CODE . '</td> '.
	      		'	<td>
	      				<input type="text" name="item_file_embed_' . $media_type . '" id="item_file_embed_' . $media_type . '" style="width: 250px;" /></td> '.
	      		((!$this->upload_url) ? $upload_btn_content : '') .
	   			'</tr> '.
	   			'<tr>'.
	   			'	<td>'.
	   			'	<td colspan="2">' . MSG_EMBEDDED_CODE_NOTE . '</td>'.
	   			'</tr>';   
	   						
   		}
   		else 
   		{
   			$display_output .= '<input type="hidden" name="item_file_embed_' . $media_type . '" id="item_file_embed_' . $media_type . '" value="">';
   		}
   		
   		if (!$add_upload_btn)
   		{
   			$display_output .= '<input type="hidden" name="btn_upload_file" id="btn_upload_' . $media_type . '" value="" />';
   		}
   		
   		$display_output .= '<tr class="reguser"> '.
      		'	<td class="contentfont" align="right">' . $display_fee . '</td> '.
      		'	<td colspan="2">' . MSG_YOU_CAN_UPL_UP_TO . ' ' . $max_media . ' ' . $msg_media . '. ' . $fee_message . '</td> '.
   			'</tr> ';

  			$display_output .= '<tr> '.
      		'	<td width="150" align="right">&nbsp;</td> '.
      		'	<td colspan="2">';
            
      	$display_output .= '<div id="display_media_boxes_' . $media_name . '">';
	      	
		   $counter = 0;

		   if (is_array($variables_array[$media_name]))
		   {			   	
			   foreach ($variables_array[$media_name] as $ad_media)
			   {
               if (!empty($ad_media))
               {
                  /* v6.1 -> change the display of an upload box so we can easily add new boxes and remove deleted ones from the view */

                  $thumbnail_display = null;
                  $box_id = $this->box_id($ad_media);

                  if ($media_type == 1) /* image thumbnail */
                  {
                     $thumbnail_display = '<img src="' . SITE_PATH . 'thumbnail.php?pic=' . $ad_media . '&w=80&sq=Y&b=Y" border="0" alt="' . $ad_media . '"> ';
                  }
                  else if ($media_type == 2) /* video thumbnail */
                  {
                     $thumbnail_display = '<img src="' . SITE_PATH . 'thumbnail.php?pic=images/media_icon.gif&w=80&sq=Y&b=Y" border="0" alt="' . $ad_media . '"> ';
                  }
                  else if ($media_type == 3) /* digital media thumbnail */
                  {
                     $thumbnail_display = '<img src="' . SITE_PATH . 'thumbnail.php?pic=images/dd_icon.gif&w=80&sq=Y&b=Y" border="0" alt="' . $this->addlfile_name_display($ad_media, $variables_array['reverse_id']) . '"> ';
                  }

                  $item_id = ($variables_array['item_id'] > 0) ? $variables_array['item_id'] : $variables_array['auction_id'];
                  $item_id = intval($item_id);
                  
                  $thumbnail_display .= '<br>' . GMSG_DELETE . 
                     ' <input type="checkbox" name="delete_media[]" value="1" onclick="delete_media_async(\'' . $this->box_id($ad_media, '') . '\', ' . $media_type . ', ' . $item_id . ');" />';

                  $display_output .= '<div class="thumbnail_display" id="' . $box_id . '">' . $thumbnail_display . '</div>';
               }
            }
			}
            
			$display_output .= '</div>';

			$display_output .= '</td></tr> ';

			if ($box_title)
			{
				$display_output .= '<tr class="reguser"> '.
				'	<td>&nbsp;</td> '.
				'	<td colspan="2">' . $msg_uploaded_media_expl . '</td> '.
				'</tr> ';
			}

   		if ($new_table)
   		{
   			$display_output .= '</table>';
   		}
		}

		return $display_output;
	}
0

Show the code for upload_media_async.
The upload_manager function looks like it is PHP not JavaScript (as you have it tagged as)

When the size is 2000 to 2500 and you get undefined, what is the value of $display_output.

0

upload_media_async:

function upload_media_async(form_name, media_type, file_path, file_url, file_embed, nb_uploads, max_uploads, upload_id) {	
	var radio_buttons = new Array();
	for (var i=0; i<form_name.length; i++)
	{
		if (form_name.elements[i].type == 'radio' && form_name.elements[i].checked == true)
		{
			radio_buttons[form_name.elements[i].name] = form_name.elements[i].value;
		}
	}

	jsHttp = new JsHttpRequest();
	xmlHttp=GetXmlHttpObject();
	
	if (jsHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}

	var media_name = '';
	switch (media_type)
	{
		case 1:
			media_name = 'ad_image';
			break;
		case 2:
			media_name = 'ad_video';
			break;
		case 3:
			media_name = 'ad_dd';
			break;		
	}
	
	media_box_name = 'display_media_boxes_' + media_name;

	file_embed = base64Encode(file_embed);
	var url    = '<? echo (IN_ADMIN == 1) ? '../' : '';?>' + 'ajax_files/upload_file.php';
	var action = url + '?do=add&media_type=' + media_type + '&file_url=' + file_url +
		'&file_embed=' + file_embed + '&nb_uploads=' + nb_uploads + '&upload_id=' + upload_id;

	var thumbnail_div = document.getElementById('display_media_boxes_' + media_name);
	var new_content = document.createElement('div');
	
	if (file_embed != '')
	{
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState == 4)
			{
				var response = xmlHttp.responseText;
				results = response.split('|');

				if (results[5] != '')
				{
					alert (results[5]);
				}
				else
				{
					new_content.innerHTML = results[3];

					while (new_content.firstChild) {
						thumbnail_div.appendChild(new_content.firstChild);
					}

					var hidden_div = document.getElementById('hidden_media_boxes');
					var hidden_content = document.createElement('div');
					hidden_content.innerHTML = '<input type="hidden" name="' + results[1] + '[]" id="hidden_' + results[2] + '" value="' + results[4] + '">';

					while (hidden_content.firstChild) {
						hidden_div.appendChild(hidden_content.firstChild);
					}
					nb_uploads++;
				}

				document.getElementById('div_file_' + media_type).innerHTML = document.getElementById('div_file_' + media_type).innerHTML;
				document.getElementById('item_file_url_' + media_type).value = '';
				document.getElementById('item_file_embed_' + media_type).value = '';

				if (nb_uploads>=max_uploads)
				{
					document.getElementById('btn_upload_' + media_type).disabled = true;
					document.getElementById('item_file_upload_' + media_type).disabled = true;
					document.getElementById('item_file_url_' + media_type).disabled = true;
					document.getElementById('item_file_embed_' + media_type).disabled = true;
				}
				document.getElementById('nb_uploads_' + media_type).value = nb_uploads;
			}
		};
		xmlHttp.open("POST", action, true);
		xmlHttp.send(null);
	}
	else
	{
		var image_loading = document.createElement('div');
		image_loading.innerHTML = '<img src="<? echo (IN_ADMIN == 1) ? '../' : '';?>images/loading-media.gif">';
		thumbnail_div.appendChild(image_loading); 	
		
		jsHttp.onreadystatechange = function() {
			if (jsHttp.readyState == 4)
			{
				var response = jsHttp.responseText;
				results = response.split('|');

				if (results[5] != '')
				{
					thumbnail_div.removeChild(image_loading);
					alert (results[5]);
				}
				else
				{
					new_content.innerHTML = results[3];

					while (new_content.firstChild) {
						thumbnail_div.replaceChild(new_content.firstChild, image_loading);
					}

					var hidden_div = document.getElementById('hidden_media_boxes');
					var hidden_content = document.createElement('div');
					hidden_content.innerHTML = '<input type="hidden" name="' + results[1] + '[]" id="hidden_' + results[2] + '" value="' + results[4] + '">';

					while (hidden_content.firstChild) {
						hidden_div.appendChild(hidden_content.firstChild);
					}
					nb_uploads++;
				}

				document.getElementById('div_file_' + media_type).innerHTML = document.getElementById('div_file_' + media_type).innerHTML;
				document.getElementById('item_file_url_' + media_type).value = '';
				document.getElementById('item_file_embed_' + media_type).value = '';

				if (nb_uploads>=max_uploads)
				{
					document.getElementById('btn_upload_' + media_type).disabled = true;
					document.getElementById('item_file_upload_' + media_type).disabled = true;
					document.getElementById('item_file_url_' + media_type).disabled = true;
					document.getElementById('item_file_embed_' + media_type).disabled = true;
				}
				document.getElementById('nb_uploads_' + media_type).value = nb_uploads;		
				
				for (var i=0; i<form_name.length; i++)
				{
					if (form_name.elements[i].type == 'radio' && radio_buttons[form_name.elements[i].name] == form_name.elements[i].value)
					{
						form_name.elements[i].checked = true;
					}
				}						
			}
		};
		jsHttp.open("POST", action, true);
		jsHttp.send( { file: file_path } );
	}	
}

upload_manager

function upload_manager($variables_array, $media_type = 1, $form_name = null, $manager_display = false, $new_table = false, $box_title = true, $display_fee = null, $reverse_dd = false)
	{
		(string) $display_output = null;
		/**
		 * Media Types:
		 * 1 -> image
		 * 2 -> video
		 * 3 -> digital download
		 *
		 * if $no_display = true, then display only hidden fields. Otherwise display the actual download manager
		 */

		if (!$manager_display)
		{
			$display_output .= '<div id="hidden_media_boxes">';
			if (is_array($variables_array['ad_image']))
			{
				foreach ($variables_array['ad_image'] as $ad_media)
				{
					if (!empty($ad_media))
					{
						$display_output .= '<input type="hidden" id="' . $this->box_id($ad_media, 'hidden_') . '" name="ad_image[]" value="' . $ad_media . '"> ';
					}
				}
			}
			
			if (is_array($variables_array['ad_video']))
			{
				foreach ($variables_array['ad_video'] as $ad_media)
				{
					if (!empty($ad_media))
					{
						$display_output .= '<input type="hidden" id="' . $this->box_id($ad_media, 'hidden_') . '" name="ad_video[]" value="' . $ad_media . '"> ';
					}
				}
			}
						
			if (is_array($variables_array['ad_dd']))
			{
				if ($this->setts['dd_enabled'])
				{
					foreach ($variables_array['ad_dd'] as $ad_media)
					{
						if (!empty($ad_media))
						{
							$ad_media = str_replace($this->setts['dd_folder'], '', $ad_media);
							$display_output .= '<input type="hidden" id="' . $this->box_id($ad_media, 'hidden_') . '" name="ad_dd[]" value="' . $ad_media . '"> ';
						}
					}
				}
			}
			$display_output .= '</div>';
		}
		else
		{
			if ($this->show_free_images)
			{
				$this->fees = new fees();
				$this->fees->setts = &$this->setts;
				
				$this->fees->set_fees(null, $variables_array['category_id']);
			}
			
			if ($media_type == 1) /* image upload manager */
			{
				$nb_uploads = $this->count_contents($variables_array['ad_image']);
				$submit_btn_status = ($nb_uploads<$this->setts['max_images']) ? '' : 'disabled';
				$max_media = $this->setts['max_images'];
				$media_name = 'ad_image';

				$msg_upload_box_title = MSG_AD_IMAGES;
				$msg_media = MSG_IMAGES;
				$msg_uploaded_media = MSG_UPLOADED_IMAGES;
				$msg_uploaded_media_expl = MSG_UPLOADED_IMAGES_EXPL;
				
				if ($this->show_free_images)
				{
					$fee_message = ($this->fees->min_charged_image) ? ('<br>' . MSG_FIRST . ' ' . $this->fees->min_charged_image . ' ' . MSG_IMAGES . ' ' . MSG_WILL_BE_FREE) : '';
				}
			}
			else if ($media_type == 2) /* video upload manager */
			{
				$nb_uploads = $this->count_contents($variables_array['ad_video']);
				$submit_btn_status = ($nb_uploads<$this->setts['max_media']) ? '' : 'disabled';
				$max_media = $this->setts['max_media'];
				$media_name = 'ad_video';

				$msg_upload_box_title = MSG_AD_MEDIA;
				$msg_media = MSG_VIDEOS;
				$msg_uploaded_media = MSG_UPLOADED_VIDEOS;
				$msg_uploaded_media_expl = MSG_UPLOADED_VIDEOS_EXPL;

				if ($this->show_free_images)
				{
					$fee_message = ($this->fees->min_charged_video) ? ('<br>' . MSG_FIRST . ' ' . $this->fees->min_charged_video . ' ' . MSG_VIDEOS_SIMPLE . ' ' . MSG_WILL_BE_FREE) : '';
				}
			}
			else if ($media_type == 3) /* digital media upload manager */
			{
				$nb_uploads = $this->count_contents($variables_array['ad_dd']);
				$submit_btn_status = ($nb_uploads<$this->setts['max_dd']) ? '' : 'disabled';
				$max_media = $this->setts['max_dd'];
				$media_name = 'ad_dd';

				$msg_upload_box_title = ($reverse_dd) ? MSG_ADDITIONAL_FILES : MSG_DIGITAL_GOODS;
				$msg_media = ($reverse_dd) ? MSG_REVERSE_DD_FILES : MSG_FILES;
				$msg_uploaded_media = MSG_UPLOADED_FILES;
				$msg_uploaded_media_expl = MSG_UPLOADED_FILES_EXPL;
				
				## uncomment the line below if you dont want to allow remote files to be added for digital downloads
				//$this->upload_url = false; 
			}

			if ($new_table)
			{
				$display_output = '<table width="100%" border="0" cellpadding="3" cellspacing="2"> ';
			}

			if ($box_title)
			{
				$display_output .= '<tr class="c4"> '.
	      		'	<td colspan="3"><a href="' . $anchor_name . '"></a>' . $msg_upload_box_title . '</td> '.
	   			'</tr> '.
	   			'<tr class="c5"> '.
	      		'	<td><img src="themes/' . $this->setts['default_theme'] . '/img/pixel.gif" width="150" height="1"></td> '.
	      		'	<td colspan="2"><img src="themes/' . $this->setts['default_theme'] . '/img/pixel.gif" width="1" height="1"></td> '.
	   			'</tr> ';
			}

   		$display_output .= '<tr class="c1"> '.
   			'	<input type="hidden" name="nb_uploads_' . $media_type . '" id="nb_uploads_' . $media_type . '" value="' . $nb_uploads . '">'.
      		'	<td align="right" nowrap>' . MSG_UPLOAD_FILE . '</td> '.
      		'	<td>
      				<div id="div_file_' . $media_type . '">
      					<input type="file" name="item_file_upload_' . $media_type . '" id="item_file_upload_' . $media_type . '" style="width: 250px;" 
	      					onchange="upload_media_async(' . $form_name . ', ' . $media_type . ', 
	      						this.form.item_file_upload_' . $media_type . ', 
	      						document.getElementById(\'item_file_url_' . $media_type . '\').value, 
	      						document.getElementById(\'item_file_embed_' . $media_type . '\').value, 
	      						document.getElementById(\'nb_uploads_' . $media_type . '\').value, 
	      						' . $max_media . ', 
	      						\'' . $this->set_upload_id($variables_array) . '\');" ' . $submit_btn_status . ' />
	      			</div>
	      		</td> '.
      		'	<td></td>'.
   			'</tr> ';
   		
   		$upload_btn_content = '<td ' . (($this->upload_url) ? (($media_type == 2 && $this->setts['enable_embedded_media']) ? 'rowspan="2"' : 'rowspan="1"') : '') . ' width="100%"> '.
      		'	<input type="button" name="btn_upload_file" id="btn_upload_' . $media_type . '" value="' . GMSG_UPLOAD . '" '.
      		'		onclick="upload_media_async(' . $form_name . ', ' . $media_type . ', 
      					this.form.item_file_upload_' . $media_type . ', 
      					document.getElementById(\'item_file_url_' . $media_type . '\').value, 
      					document.getElementById(\'item_file_embed_' . $media_type . '\').value, 
      					document.getElementById(\'nb_uploads_' . $media_type . '\').value, 
      					' . $max_media . ', 
      					\'' . $this->set_upload_id($variables_array) . '\');" ' . $submit_btn_status . ' /> '.
      		'	</td> ';
   			
      	$add_upload_btn = false;
   		if ($this->upload_url)
   		{
   			$add_upload_btn = true;
	   		$display_output .= '<tr class="c2"> '.
	      		'	<td align="right" nowrap>' . MSG_ENTER_FILE_URL . '</td> '.
	      		'	<td>
	      				<input type="text" name="item_file_url_' . $media_type . '" id="item_file_url_' . $media_type . '" style="width: 250px;" /></td> '.    
	      		$upload_btn_content .  		
	   			'</tr> ';
   		}
   		else 
   		{
				$display_output .= '<input type="hidden" name="item_file_url_' . $media_type . '" id="item_file_url_' . $media_type . '" value="" />';   			
   		}
   		
   		if ($media_type == 2 && $this->setts['enable_embedded_media'])
   		{
   			$add_upload_btn = true;
	   		$display_output .= '<tr class="c2"> '.
	   			//'	<input type="hidden" name="embedded_code" value="1">'.
	      		'	<td align="right" nowrap>' . MSG_ENTER_EMBEDDED_CODE . '</td> '.
	      		'	<td>
	      				<input type="text" name="item_file_embed_' . $media_type . '" id="item_file_embed_' . $media_type . '" style="width: 250px;" /></td> '.
	      		((!$this->upload_url) ? $upload_btn_content : '') .
	   			'</tr> '.
	   			'<tr>'.
	   			'	<td>'.
	   			'	<td colspan="2">' . MSG_EMBEDDED_CODE_NOTE . '</td>'.
	   			'</tr>';   
	   						
   		}
   		else 
   		{
   			$display_output .= '<input type="hidden" name="item_file_embed_' . $media_type . '" id="item_file_embed_' . $media_type . '" value="">';
   		}
   		
   		if (!$add_upload_btn)
   		{
   			$display_output .= '<input type="hidden" name="btn_upload_file" id="btn_upload_' . $media_type . '" value="" />';
   		}
   		
   		$display_output .= '<tr class="reguser"> '.
      		'	<td class="contentfont" align="right">' . $display_fee . '</td> '.
      		'	<td colspan="2">' . MSG_YOU_CAN_UPL_UP_TO . ' ' . $max_media . ' ' . $msg_media . '. ' . $fee_message . '</td> '.
   			'</tr> ';

  			$display_output .= '<tr> '.
      		'	<td width="150" align="right">&nbsp;</td> '.
      		'	<td colspan="2">';
            
      	$display_output .= '<div id="display_media_boxes_' . $media_name . '">';
	      	
		   $counter = 0;

		   if (is_array($variables_array[$media_name]))
		   {			   	
			   foreach ($variables_array[$media_name] as $ad_media)
			   {
               if (!empty($ad_media))
               {
                  /* v6.1 -> change the display of an upload box so we can easily add new boxes and remove deleted ones from the view */

                  $thumbnail_display = null;
                  $box_id = $this->box_id($ad_media);

                  if ($media_type == 1) /* image thumbnail */
                  {
                     $thumbnail_display = '<img src="' . SITE_PATH . 'thumbnail.php?pic=' . $ad_media . '&w=80&sq=Y&b=Y" border="0" alt="' . $ad_media . '"> ';
                  }
                  else if ($media_type == 2) /* video thumbnail */
                  {
                     $thumbnail_display = '<img src="' . SITE_PATH . 'thumbnail.php?pic=images/media_icon.gif&w=80&sq=Y&b=Y" border="0" alt="' . $ad_media . '"> ';
                  }
                  else if ($media_type == 3) /* digital media thumbnail */
                  {
                     $thumbnail_display = '<img src="' . SITE_PATH . 'thumbnail.php?pic=images/dd_icon.gif&w=80&sq=Y&b=Y" border="0" alt="' . $this->addlfile_name_display($ad_media, $variables_array['reverse_id']) . '"> ';
                  }

                  $item_id = ($variables_array['item_id'] > 0) ? $variables_array['item_id'] : $variables_array['auction_id'];
                  $item_id = intval($item_id);
                  
                  $thumbnail_display .= '<br>' . GMSG_DELETE . 
                     ' <input type="checkbox" name="delete_media[]" value="1" onclick="delete_media_async(\'' . $this->box_id($ad_media, '') . '\', ' . $media_type . ', ' . $item_id . ');" />';

                  $display_output .= '<div class="thumbnail_display" id="' . $box_id . '">' . $thumbnail_display . '</div>';
               }
            }
			}
            
			$display_output .= '</div>';

			$display_output .= '</td></tr> ';

			if ($box_title)
			{
				$display_output .= '<tr class="reguser"> '.
				'	<td>&nbsp;</td> '.
				'	<td colspan="2">' . $msg_uploaded_media_expl . '</td> '.
				'</tr> ';
			}

   		if ($new_table)
   		{
   			$display_output .= '</table>';
   		}
		}

		return $display_output;
	}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.