Por favor, como hago para que al subir el mismo archivo, lo sobrescriba siempre?
Dejo el código:
[PHP]<?php
/**
* CoffeeCup Flash Form Builder: Form Results Handler
*
* This file is in charge of handling the form results
* posted from the CoffeeCup Flash Form Builder SWF.
* It has several primary functions:
*
* - Assure that the user is running the proper version of
* PHP and has properly configured their server for
* CoffeeCup Flash Form Builder by uploading the provided
* files and assigning the appropriate server settings
* and permissions.
* - Upload a file if the '$_FILES['Filedata']' variable is
* populated
* - If the '$_POST' superglobal array has been populated,
* process the form by:
* - Reading the config file provided in the '$_POST['xmlfile']'
* variable.
* - Saving the form data to a file if the 'CC_FB_SAVE_FILE' constant
* has been populated.
* - Saving the form data to the database provided in 'CC_FB_DB_ADDRESS'
* if the 'CC_FB_DB_ADDRESS' constant is populated.
* - Emailing the form data to the form owner via the address provided
* in the '$_POST['_ALT_EMAIL']' variable or the '$_POST['mailto']'
* variable if the '$_POST['_ALT_EMAIL']' variable is not populated.
* - Emailing the form data to the form user via the address provided in
* the '$_POST['eM']' variable if the '$_POST['eM']' variable has been
* populated and the 'emailuser' config option is set to 'true'.
* - Taking the form user to the landing page provided in the
* '$_POST['thankyoupage']' variable or to a default landing page
* if the '$_POST['thankyoupage']' is empty.
* - Prints out an informational page with version numbers and release
* dates if an error occurs or if this script is called without
* the '$_POST' superglobal or the '$_FILES['Filedata']' variables
* being set.
*
* @license http://www.coffeecup.com/legal/eula.html
* @author Jeff Welch <[email protected]>
* @version 4.0
* @package CC_FB
*/
// Error reporting should be disabled in favor of
// our customer error messages.
error_reporting(0);
/**
* The version of CoffeeCup Flash Form Builder that
* generated this script.
*/
define('CC_FB_VERSION', '8.0');
/**
* The release date of the version of CoffeeCup Flash Form
* Builder that generated this script.
*/
define('CC_FB_LAST_UPDATED', '02/09/2010');
/**
* The version of this script.
*/
define('CC_FB_SCRIPT_VERSION', '5.1');
/**
* The release date of this script.
*/
define('CC_FB_SCRIPT_LAST_UPDATED', '02/09/2010');
/**
* Will the owner of this form be emailed the
* form data
*/
define('CC_FB_DO_EMAIL',false);
/**
* To default To address.
*/
define('CC_FB_TO_EMAIL', '');
/**
* The default CC address.
*/
define('CC_FB_CC_EMAIL', '');
/**
* The default BCC address.
*/
define('CC_FB_BCC_EMAIL', '');
/**
* The message to send to the form owner
*/
define('CC_FB_OWNER_MESSAGE', '[FORMOWNERMSG]');
/**
* If we should send a message back to the user.
*/
define('CC_FB_AUTO_REPLY', false);
/**
* The subject of the message to be sent to the user.
*/
define('CC_FB_AUTO_REPLY_SUBJECT', '');
/**
* If we should include the form results
* in the message we send to the user.
*/
define('CC_FB_AUTO_REPLY_FORM_RESULTS', false);
/**
* The position of the auto-reply message
* in the email.
*/
define('CC_FB_AUTO_REPLY_POSITION', 'bottom');
/**
* The page to redirect to after the form is submitted.
*/
define('CC_FB_RESULTS_REDIRECT', '[RESULTSREDIRECT]');
/**
* The address of the database where the form results
* will be saved.
*/
define('CC_FB_DB_ADDRESS', '[ADDRESS]');
/**
* The port number of the database where the form results
* will be saved.
*/
define('CC_FB_DB_PORT', '[DBPORT]');
/**
* The username for the database where the form results
* will be saved.
*/
define('CC_FB_DB_USERNAME', '[DBUSER]');
/**
* The password for the database where the form results
* will be saved.
*/
define('CC_FB_DB_PASSWORD', '[DBPASS]');
/**
* The name of the database where the form results
* will be saved.
*/
define('CC_FB_DB_NAME', '[DBNAME]');
/**
* The name of the database table where the form results
* will be saved.
*/
define('CC_FB_DB_TABLE', '[DBTABLE]');
/**
* The file to log the form results to if necessary.
*/
define('CC_FB_SAVE_FILE', '[FILENAME]');
/**
* The filetypes that are acceptable for file uploads.
*/
define('CC_FB_ACCEPTABLE_FILE_TYPES', 'pdf');
/**
* The directory where files are uploaded
*/
define('CC_FB_UPLOADS_DIRECTORY', 'paquetes');
/**
* The extension that gets added to file uploads
*/
define('CC_FB_UPLOADS_EXTENSION', '_utt');
/**
* Will we save the file uploads to the server
*/
define('CC_FB_ATTACHMENT_SAVETOSERVER',true);
/**
* Will we save the file uploads to the db
*/
define('CC_FB_ATTACHMENT_SAVETODB',false);
/**
* Will we send the file upload as an attachment
*/
define('CC_FB_ATTACHMENT_ADDTOEMAIL',false);
/**
* Sendmail Message EOL's
*/
define('CC_FB_SENDMAIL_EOL',"\r\n");
// Makes sure that the user is using the required version
// of PHP as specified by {@link CC_FB_PHP_VERSION}.
if(!version_compare(PHP_VERSION, CC_FB_PHP_VERSION, '>='))
{
printMessage('Invalid PHP Version',
"We're sorry but CoffeeCup Form Builder requires PHP version " .
CC_FB_PHP_VERSION . ' or greater. Please contact your server ' .
'administrator.');
}
// Strip slashes if the server has magic quotes enabled.
if(get_magic_quotes_gpc())
{
$_POST = array_map("stripslashes", $_POST);
}
// John will need to fix this in the swf file.
foreach($_POST as $key => $value)
{
$_POST[str_replace('_', ' ', $key)] = $value;
}
// Let's sanitize some header fields before it gets us in any trouble.
foreach(array('eM','_ALT_EMAIL','subject') as $key)
{
if(isset($_POST[$key]))
{
$_POST[$key] = headerEscape($_POST[$key]);
}
}
Aquí en esta lineas, vi que puede estar la solución:
Código PHP:
* The filetypes that are acceptable for file uploads.
*/
define('CC_FB_ACCEPTABLE_FILE_TYPES', 'pdf');
/**
* The directory where files are uploaded
*/
define('CC_FB_UPLOADS_DIRECTORY', 'paquetes');
/**
* The extension that gets added to file uploads
*/
define('CC_FB_UPLOADS_EXTENSION', '_utt');
/**
* Will we save the file uploads to the server
*/
define('CC_FB_ATTACHMENT_SAVETOSERVER',true);
/**
Muchas gracias, besos.