Location: PHPKode > projects > QuickTalk Forum > quicktalk/qtf_adm_tags_upload.php
<?php

/**
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to hide@address.com so we can mail you a copy immediately.
*
* @category   Forum
* @package    QuickTalk
* @author     Philippe Vandenberghe <hide@address.com>
* @copyright  2008-2012 The PHP Group
* @license    http://www.php.net/license PHP License 3.0
* @version    2.5 build:20100924
* @since      File available since Release 1.0.0
* @deprecated File deprecated in Release 3.0.0
*/

session_start();
require_once('bin/qtf_init.php');
include(Translate('qtf_adm.php'));

if ( $oVIP->role!='A' ) die($L['E_admin']);

// INITIALISE

$tt='en';
$v = '';
if ( isset($_GET['v']) ) $v = strip_tags($_GET['v']);
if ( isset($_POST['v']) ) $v = strip_tags($_POST['v']);
if ( empty($v) ) $error = 'Missing file name';
if ( isset($_GET['tt']) ) $tt = strip_tags($_GET['tt']);
if ( isset($_POST['tt']) ) $tt = strip_tags($_POST['tt']);

$intSize = 100;

$oVIP->selfurl = 'qtf_adm_tags_upload.php';
$oVIP->selfname = $L['Add'].' CSV '.strtolower($L['File']);
$oVIP->exiturl = 'qtf_adm_tags.php';
$oVIP->exitname = $L['Tags'];

// --------
// SUBMITTED FOR UPLOAD
// --------

if ( isset($_POST['ok']) )
{
  // Check uploaded document

  $error = InvalidUpload($_FILES['title'],'csv,txt,text','',500);

  // Save

  if ( empty($error) )
  {
    copy($_FILES['title']['tmp_name'],'upload/'.$v);
    unlink($_FILES['title']['tmp_name']);
    $oVIP->EndMessage(NULL,$L['S_update'],$_SESSION[QT]['skin_dir'],2);
  }
}

// --------
// HTML START
// --------

$strHeadScript = '
<script type="text/javascript">
<!--
function ValidateForm(theForm)
{
  if (theForm.title.value.length==0) { alert("'.$L['E_mandatory'].': File"); return false; }
  return null;
}
function ValidateWarning(str)
{
  if (str.value=="'.$v.'") 
  {
  document.getElementById("warning").style.visibility="visible";
  }
  else
  {
  document.getElementById("warning").style.visibility="hidden";
  }
  return null;
}
-->
</script>
';
include('qtf_adm_p_header.php');

$str='';
if ( file_exists('upload/'.$v) ) $str = 'upload/'.$v;

echo '<br/>',N;
echo '<table class="hidden" cellspacing="0" summary="tags">',N;
echo '<tr class="hidden">',N;
echo '<td class="hidden">',N;

HtmlMsg(0,'400px','',$oVIP->selfname);

echo '<form method="post" action="',$oVIP->selfurl,'" enctype="multipart/form-data" onsubmit="return ValidateForm(this);">',N;

if ( !empty($error) ) echo '<span class="error">',$error,'</span>',N;
echo '<p style="text-align:right">',N;
echo $L['File'],': <input type="hidden" name="max_file_size" value="',($intSize*1024),'"/>',N;
echo '<input type="file" id="title" name="title" size="32"/><br/><br/><br/><br/>',N;
echo $L['Destination'],':  upload/<input type="text" id="v" name="v" size="25" maxlength="25" value="',$v,'" onkeyup="ValidateWarning(this);"/><br/><br/>',N;
echo '<span id="warning" class="warning">',(file_exists('upload/'.$v) ? $L['E_overwrite_file'].' ['.$v.']' : ''),'</span> ';
echo '<input type="hidden" name="tt" value="',$tt,'"/>',N;
echo '<input type="submit" name="ok" value="',$L['Ok'],'"/></p>',N;
echo '</form>',N;
echo '<p><a href="',$oVIP->exiturl,'?tt=',$tt,'">&laquo; ',$oVIP->exitname,'</a></p>';

HtmlMsg(1);

echo '
</td>
</tr>
</table>
';

// HTML END

include('qtf_adm_p_footer.php');

?>
Return current item: QuickTalk Forum