Problema com Upload
E ai pessoal??Td beleza?
Seguinte:
Tenho um arquivo (encontrei na internet) que faz o upload na mesma página do formulário, porém o mesmo está funcionando certinho no meu pc, mas no servidor ele da um erro de "File upload error. Internal error."
Segue abaixo o código...
index.php
<?php require_once('Connections/absconcexao.php'); ?>
<?php
// Load the common classes
require_once('includes/common/KT_common.php');
// Load the tNG classes
require_once('includes/tng/tNG.inc.php');
// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("");
// Make unified connection variable
$conn_absconcexao = new KT_connection($absconcexao, $database_absconcexao);
// Start trigger
$formValidation = new tNG_FormValidation();
$tNGs->prepareValidation($formValidation);// End trigger
//start Trigger_ImageUpload trigger
//remove this line if you want to edit the code by hand
function Trigger_ImageUpload(&$tNG) {
$uploadObj = new tNG_ImageUpload($tNG);
$uploadObj->setFormFieldName("foto");
$uploadObj->setDbFieldName("foto");
$uploadObj->setFolder("fotoint/");
$uploadObj->setMaxSize(15000);
$uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png");
$uploadObj->setRename("auto");
return $uploadObj->Execute();
}//end Trigger_ImageUpload trigger
// Make an insert transaction instance
$ins_integrante = new tNG_insert($conn_absconcexao);
$tNGs->addTransaction($ins_integrante);// Register triggers
$ins_integrante->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_integrante->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_integrante->registerTrigger("END", "Trigger_Default_Redirect", 99, "lista_integrantes.php");
$ins_integrante->registerTrigger("AFTER", "Trigger_ImageUpload", 97);// Add columns
$ins_integrante->setTable("integrante");
$ins_integrante->addColumn("nome", "STRING_TYPE", "POST", "nome");
$ins_integrante->addColumn("foto", "FILE_TYPE", "FILES", "foto");
$ins_integrante->addColumn("data_entrada", "STRING_TYPE", "POST", "data_entrada");
$ins_integrante->addColumn("data_saida", "STRING_TYPE", "POST", "data_saida");
$ins_integrante->setPrimaryKey("id", "NUMERIC_TYPE");
// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset
$rsintegrante = $tNGs->getRecordset("integrante");
$row_rsintegrante = mysql_fetch_assoc($rsintegrante);
$totalRows_rsintegrante = mysql_num_rows($rsintegrante);
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
echo $tNGs->getErrorMsg();
?>
<form method="post" id="form1" action="<?php echo $row_rsintegrante['']; ?>" enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<tr>
<td class="KT_th"><label for="nome">Nome:</label></td>
<td><input name="nome" type="text" class="btn" id="nome" value="<?php echo KT_escapeAttribute($row_rsintegrante['nome']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("nome");?> <?php echo $tNGs->displayFieldError("integrante", "nome"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="foto">Foto:</label></td>
<td><input name="foto" type="file" class="btn" id="foto" size="32" maxlength="200" />
<?php echo $tNGs->displayFieldError("integrante", "foto"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="data_entrada">Data Entrada:</label></td>
<td><input name="data_entrada" type="text" class="btn" id="data_entrada" value="<?php echo KT_escapeAttribute($row_rsintegrante['data_entrada']); ?>" size="10" maxlength="10" />
<?php echo $tNGs->displayFieldHint("data_entrada");?> <?php echo $tNGs->displayFieldError("integrante", "data_entrada"); ?> </td>
</tr>
<tr>
<td class="KT_th"><label for="data_saida">Data Saída:</label></td>
<td><input name="data_saida" type="text" class="btn" id="data_saida" value="<?php echo KT_escapeAttribute($row_rsintegrante['data_saida']); ?>" size="10" maxlength="10" />
<?php echo $tNGs->displayFieldHint("data_saida");?> <?php echo $tNGs->displayFieldError("integrante", "data_saida"); ?> </td>
</tr>
<tr class="KT_buttons">
<td colspan="2"><input name="KT_Insert1" type="submit" class="btnlink" id="KT_Insert1" value="Cadastrar Integrante" />
</td>
</tr>
</table>
</form>
</body>
</html>
KT_common.php
<?php
/*
* ADOBE SYSTEMS INCORPORATED
* Copyright 2007 Adobe Systems Incorporated
* All Rights Reserved
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
* terms of the Adobe license agreement accompanying it. If you have received this file from a
* source other than Adobe, then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
/*
Copyright (c) InterAKT Online 2000-2006. All rights reserved.
*/
$KT_CMN_uploadErrorMsg = '<strong>File not found:</strong> <br />%s<br /><strong>Please upload the includes/ folder to the testing server.</strong>';
$KT_CMN_uploadFileList = array('KT_config.inc.php', 'KT_functions.inc.php');
for ($KT_CMN_i=0;$KT_CMN_i<sizeof($KT_CMN_uploadFileList);$KT_CMN_i++) {
$KT_CMN_uploadFileName = dirname(realpath(__FILE__)). '/' . $KT_CMN_uploadFileList[$KT_CMN_i];
if (file_exists($KT_CMN_uploadFileName)) {
require_once($KT_CMN_uploadFileName);
} else {
die(sprintf($KT_CMN_uploadErrorMsg,$KT_CMN_uploadFileList[$KT_CMN_i]));
}
}
?>
tNG.inc.php
<?php
/*
* ADOBE SYSTEMS INCORPORATED
* Copyright 2007 Adobe Systems Incorporated
* All Rights Reserved
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
* terms of the Adobe license agreement accompanying it. If you have received this file from a
* source other than Adobe, then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
/*
Copyright (c) InterAKT Online 2000-2006. All rights reserved.
*/
$KT_tNG_uploadErrorMsg = '<strong>File not found:</strong> <br />%s<br /><strong>Please upload the includes/ folder to the testing server.</strong>';
$KT_tNG_uploadFileList1 = array(
'tNG_config.inc.php',
'../common/KT_common.php',
'tNG_functions.inc.php',
'triggers/tNG_TidyContent.inc.php',
'triggers/tNG_defTrigg.inc.php',
'../common/lib/resources/KT_Resources.php',
'../common/lib/shell/KT_Shell.php',
'../common/lib/folder/KT_Folder.php',
'../common/lib/file_upload/KT_FileUpload.php',
'../common/lib/image/KT_Image.php',
'../common/lib/email/KT_Email.php',
'../common/lib/db/KT_Db.php',
'../common/lib/file/KT_File.php',
'../common/lib/captcha/KT_Captcha.php',
'../common/KT_functions.inc.php',
);
$KT_tNG_uploadFileList2 = array(
'tNG_log.class.php',
'tNG_dispatcher.class.php',
'tNG.class.php',
'tNG_fields.class.php',
'tNG_insert.class.php',
'tNG_update.class.php',
'tNG_delete.class.php',
'tNG_multiple.class.php',
'tNG_multipleInsert.class.php',
'tNG_multipleUpdate.class.php',
'tNG_multipleDelete.class.php',
'tNG_custom.class.php',
'tNG_login.class.php',
'tNG_logoutTransaction.class.php',
'tNG_import.class.php',
'tNG_error.class.php',
'triggers/tNG_SetOrderField.class.php',
'triggers/tNG_Redirect.class.php',
'triggers/tNG_FormValidation.class.php',
'triggers/tNG_FieldCompare.class.php',
'triggers/tNG_FileUpload.class.php',
'triggers/tNG_ImageUpload.class.php',
'triggers/tNG_FileDelete.class.php',
'triggers/tNG_LinkedTrans.class.php',
'triggers/tNG_CheckTableField.class.php',
'triggers/tNG_CheckUnique.class.php',
'triggers/tNG_ChkForbiddenWords.class.php',
'triggers/tNG_CheckDetailRecord.class.php',
'triggers/tNG_CheckMasterRecord.class.php',
'triggers/tNG_DeleteDetailRec.class.php',
'triggers/tNG_DeleteFolder.class.php',
'triggers/tNG_ThrowError.class.php',
'triggers/tNG_Email.class.php',
'triggers/tNG_EmailRecordset.class.php',
'triggers/tNG_EmailPageSection.class.php',
'triggers/tNG_RestrictAccess.class.php',
'triggers/tNG_Captcha.class.php',
'triggers/tNG_UserLoggedIn.class.php',
'triggers/tNG_ManyToMany.class.php',
'triggers/tNG_MtmFakeRs.class.php',
'triggers/tNG_Logout.class.php',
'triggers/tNG_DynamicThumbnail.class.php',
'triggers/tNG_DynamicMedia.class.php',
'triggers/tNG_Download.class.php',
'triggers/tNG_MFileUpload.class.php',
'triggers/tNG_MImageUpload.class.php',
'triggers/tNG_MuploadHelper.class.php',
'triggers/tNG_FileListRecordset.class.php',
'triggers/tNG_TidyContent.class.php',
);
for ($KT_tNG_i=0;$KT_tNG_i<sizeof($KT_tNG_uploadFileList1);$KT_tNG_i++) {
$KT_tNG_uploadFileName = dirname(realpath(__FILE__)). '/' . $KT_tNG_uploadFileList1[$KT_tNG_i];
if (file_exists($KT_tNG_uploadFileName)) {
require_once($KT_tNG_uploadFileName);
} else {
die(sprintf($KT_tNG_uploadErrorMsg,$KT_tNG_uploadFileList1[$KT_tNG_i]));
}
}
for ($KT_tNG_i=0;$KT_tNG_i<sizeof($KT_tNG_uploadFileList2);$KT_tNG_i++) {
$KT_tNG_uploadFileName = dirname(realpath(__FILE__)). '/' . $KT_tNG_uploadFileList2[$KT_tNG_i];
if (file_exists($KT_tNG_uploadFileName)) {
if (substr(PHP_VERSION, 0, 1) != '5') {
require_once($KT_tNG_uploadFileName);
}
} else {
die(sprintf($KT_tNG_uploadErrorMsg,$KT_tNG_uploadFileList2[$KT_tNG_i]));
}
}
function __autoload($class_name) {
$arr = array(
'tNG_log' => 'tNG_log.class.php',
'tNG_dispatcher' => 'tNG_dispatcher.class.php',
'tNG' => 'tNG.class.php',
'tNG_fields' => 'tNG_fields.class.php',
'tNG_insert' => 'tNG_insert.class.php',
'tNG_update' => 'tNG_update.class.php',
'tNG_delete' => 'tNG_delete.class.php',
'tNG_multiple' => 'tNG_multiple.class.php',
'tNG_multipleInsert' => 'tNG_multipleInsert.class.php',
'tNG_multipleUpdate' => 'tNG_multipleUpdate.class.php',
'tNG_multipleDelete' => 'tNG_multipleDelete.class.php',
'tNG_custom' => 'tNG_custom.class.php',
'tNG_login' => 'tNG_login.class.php',
'tNG_logoutTransaction' => 'tNG_logoutTransaction.class.php',
'tNG_import' => 'tNG_import.class.php',
'tNG_CSVImport' => 'tNG_CSVImport.class.php',
'tNG_XMLImport' => 'tNG_XMLImport.class.php',
'tNG_error' => 'tNG_error.class.php',
'tNG_SetOrderField' => 'triggers/tNG_SetOrderField.class.php',
'tNG_Redirect' => 'triggers/tNG_Redirect.class.php',
'tNG_FormValidation' => 'triggers/tNG_FormValidation.class.php',
'tNG_FieldCompare' => 'triggers/tNG_FieldCompare.class.php',
'tNG_FileUpload' => 'triggers/tNG_FileUpload.class.php',
'tNG_ImageUpload' => 'triggers/tNG_ImageUpload.class.php',
'tNG_FileDelete' => 'triggers/tNG_FileDelete.class.php',
'tNG_LinkedTrans' => 'triggers/tNG_LinkedTrans.class.php',
'tNG_CheckTableField' => 'triggers/tNG_CheckTableField.class.php',
'tNG_CheckUnique' => 'triggers/tNG_CheckUnique.class.php',
'tNG_ChkForbiddenWords' => 'triggers/tNG_ChkForbiddenWords.class.php',
'tNG_CheckDetailRecord' => 'triggers/tNG_CheckDetailRecord.class.php',
'tNG_CheckMasterRecord' => 'triggers/tNG_CheckMasterRecord.class.php',
'tNG_DeleteDetailRec' => 'triggers/tNG_DeleteDetailRec.class.php',
'tNG_DeleteFolder' => 'triggers/tNG_DeleteFolder.class.php',
'tNG_ThrowError' => 'triggers/tNG_ThrowError.class.php',
'tNG_Email' => 'triggers/tNG_Email.class.php',
'tNG_EmailRecordset' => 'triggers/tNG_EmailRecordset.class.php',
'tNG_EmailPageSection' => 'triggers/tNG_EmailPageSection.class.php',
'tNG_RestrictAccess' => 'triggers/tNG_RestrictAccess.class.php',
'tNG_Captcha' => 'triggers/tNG_Captcha.class.php',
'tNG_Logout' => 'triggers/tNG_Logout.class.php',
'tNG_UserLoggedIn' => 'triggers/tNG_UserLoggedIn.class.php',
'tNG_ManyToMany' => 'triggers/tNG_ManyToMany.class.php',
'tNG_MtmFakeRs' => 'triggers/tNG_MtmFakeRs.class.php',
'tNG_DynamicThumbnail' => 'triggers/tNG_DynamicThumbnail.class.php',
'tNG_DynamicMedia' => 'triggers/tNG_DynamicMedia.class.php',
'tNG_Download' => 'triggers/tNG_Download.class.php',
'tNG_MFileUpload' => 'triggers/tNG_MFileUpload.class.php',
'tNG_MImageUpload' => 'triggers/tNG_MImageUpload.class.php',
'tNG_FileListRecordset' => 'triggers/tNG_FileListRecordset.class.php',
'tNG_MuploadHelper' => 'triggers/tNG_MuploadHelper.class.php',
'tNG_TidyContent' => 'triggers/tNG_TidyContent.class.php'
);
if (isset($arr[$class_name])) {
require_once(dirname(realpath(__FILE__)). '/' . $arr[$class_name]);
}
}
if (isset($GLOBALS['KT_prefered_image_lib'])) {
$GLOBALS['tNG_prefered_image_lib'] = $GLOBALS['KT_prefered_image_lib'];
}if (isset($GLOBALS['KT_prefered_imagemagick_path'])) {
$GLOBALS['tNG_prefered_imagemagick_path'] = $GLOBALS['KT_prefered_imagemagick_path'];
}
//set SERVER variables from ENV if is CGI/FAST CGI
KT_setServerVariables();
//start the session
KT_session_start();
?>
Aguardo....
Discussão (1)
Carregando comentários...