Prv8 Shell
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4
System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64
User : jackjohn ( 502)
PHP Version : 5.3.17
Disable Function : NONE
Directory :  /home/jackjohn/www/shopsite-images/en-EU/javascript/image_upload/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/jackjohn/www/shopsite-images/en-EU/javascript/image_upload/form_upload.js
"use_strict";
$(function($){
  $('#num_files').change(function show_file_elements(){
    $('.extra.file-upload').hide();
    $('#extra-files div.extra.file-upload:nth-child(-n+'+this.value+')').show();
  });
});

function add_file(file)
{
  var file_name = file.value;
  var file_num = file.id.substr(5);
  var save_id = 'saveas_' + file_num;
  var save_as = document.getElementById(save_id);
  var add_file_name;
  var file_type;
  var index, i;

  if ((index = file_name.lastIndexOf('\\')) < 0)
    index = file_name.lastIndexOf('/');

  if (index > 0)
    file_name = file_name.substr(index + 1);

  if (file_type_permitted(file_name) == false)
  {
    alert(unallowed_upload_msg);
    file.style.borderBottomStyle = 'double';
    file.focus();
    return;
  }
  else
    file.style.borderBottomStyle = '';

  add_file_name = win32? file_name.toLowerCase() : file_name;

  for (i = 0; i < file_names.length; i++)
  {
    if (file_names[i] && file_names[i] == add_file_name)
    {
      alert(txt_dup1 + '  ' + txt_dup2);
      break;
    }
  }

  if (unallowed_filename_chars(file_name))
  {
    if ((index = file_name.lastIndexOf('.')) >= 0)
      file_name = file_name.substr(0, index);

    save_as.value = trim_filename(file_name.replace(/[^a-zA-Z0-9\-._]/g, '_'));
  }
  else
    save_as.value = '';

  file_names[file_num] = add_file_name;

  var image = $('.preview-image', file.parentElement);
  if(file.files && file.files[0]) {
    let reader = new FileReader();
    reader.onload = function(e) {image.attr('src', e.target.result).show();};
    reader.readAsDataURL(file.files[0]);
  }
}

function are_files_selected()
{
  var file, i;

  for (i = 0; i < upload_limit; i++)
  {
    file = document.getElementById('file_' + i);
    if (file != null && file.value.length > 0)
      break;
  }

  if (i == upload_limit)
  {
    alert(txt_select_files);
    return false;
  }

  return true;
}

function descriptor_labels()
{
  var image_desc = document.getElementById('desc_0');
  if (!('placeholder' in image_desc))
  {
    var i, html = '&nbsp;(' + image_desc_label + ')';
    for (i = 0; i < 30; i++)
    {
      image_desc = document.getElementById('desc_' + i);
      image_desc.insertAdjacentHTML('AfterEnd', html);
    }
  }
}

function check_saveas(row)
{
  var save_id = 'saveas_' + row;
  var save_as = document.getElementById(save_id);
  var file_name = trim_filename(save_as.value);
  save_as.value = file_name;

  if (unallowed_filename_chars(file_name))
  {
    var allowed_chars = document.getElementById('allowed_chars');
    allowed_chars.style.display = '';
    save_as.style.borderColor = 'red';
    save_as.focus();
    return false;
  }

  save_as.style.borderColor = '';
  return true;
}

function remove_unallowed_chars()
{
  var allowed_chars = document.getElementById('allowed_chars');
  var num_files = document.getElementById('num_files').value;
  var save_as;
  var i;

  for (i = 0; i < num_files; i++)
  {
    save_as = document.getElementById('saveas_' + i);
    save_as.value = save_as.value.replace(/[^a-zA-Z0-9\-._]/g, '');
    save_as.style.borderColor = '';
  }

  allowed_chars.style.display = 'none';
}

function start_upload()
{
  var num_files = document.getElementById('num_files').value;
  var file_id, save_id, save_as;
  var file_name, index, i;

  // Alert user if any file types are not permitted for uploading.
  for (i = 0; i < num_files; i++)
  {
    file_id = 'file_' + i;
    file = document.getElementById(file_id);
    file_name = file.value;

    if (file_name.length > 0)
    {
      if (file_type_permitted(file_name) == false)
      {
        alert(unallowed_upload_msg);
        file.style.borderBottomStyle = 'double';
        file.focus();
        return false;
      }
      else
        file.style.borderBottomStyle = '';
    }
  }

  // Alert user if any save_as file names have unallowed characters.
  for (i = 0; i < num_files; i++)
  {
    save_id = 'saveas_' + i;
    save_as = document.getElementById(save_id);
    file_name = save_as.value;

    if (file_name.length > 0)
    {
      if (unallowed_filename_chars(file_name))
      {
        save_as.focus();
        alert(unallowed_chars_msg);
        return false;
      }
    }
  }

  // Enter save_as file names for upload files that have unallowed
  // characters in the file name.
  for (i = 0; i < num_files; i++)
  {
    file_id = 'file_' + i;
    file_name = document.getElementById(file_id).value;

    if (file_name.length > 0)
    {
      if ((index = file_name.lastIndexOf('\\')) < 0)
        index = file_name.lastIndexOf('/');

      if (index > 0)
        file_name = file_name.substr(index + 1);

      if (unallowed_filename_chars(file_name))
      {
        save_id = 'saveas_' + i;
        save_as = document.getElementById(save_id);

        if ((index = file_name.lastIndexOf('.')) >= 0)
          file_name = file_name.substr(0, index);

        if (save_as.value.length == 0)
          save_as.value = file_name.replace(/[^a-zA-Z0-9\-._]/g, '');
      }
    }
  }

  return true;
}

function file_type_permitted(file_name)
{
  var file_type;
  var bOk = true;
  var i;

  if ((i = file_name.lastIndexOf('.')) >= 0)
  {
    file_type = file_name.substr(i + 1);
    bOk = file_type.toLowerCase() != 'php';
  }

  return bOk;
}

function resize_default()
{
  if (resize_enabled == false)
  {
    alert(resize_msg);
    document.getElementById('resize').checked = false;
  }
}


haha - 2025