acá tengo otro ejemplo que registra los proceso de subida, NO esta creado con flash, ni flex, ni javaFX, ni tampoco con applet, ni mucho menos con silverlight, lo datos de salida son tan precisos y en tiempo real que comprueba que es posible.
acá tengo el archivo en PHP
descargar codigo
Parte 1 - no me cae todo el código en el post.
Código PHP:
Ver original<?php
$db_server = 'localhost';
$db_name = '';
$db_username = '';
$db_password = '';
// Other settings (optional)
$filename = ''; // Specify the dump filename to suppress the file selection dialog
$csv_insert_table = ''; // Destination table for CSV files
$csv_preempty_table = false; // true: delete all entries from table specified in $csv_insert_table before processing
$ajax = true; // AJAX mode: import will be done without refreshing the website
$linespersession = 3000; // Lines to be executed per one import session
$delaypersession = 0; // You can specify a sleep time in milliseconds after each session
// Works only if JavaScript is activated. Use to reduce server overrun
// Allowed comment delimiters: lines starting with these strings will be dropped by BigDump
$comment[]='#'; // Standard comment lines are dropped by default
$comment[]='-- ';
// $comment[]='---'; // Uncomment this line if using proprietary dump created by outdated mysqldump
// $comment[]='CREATE DATABASE'; // Uncomment this line if your dump contains create database queries in order to ignore them
$comment[]='/*!'; // Or add your own string to leave out other proprietary things
// Connection character set should be the same as the dump file character set (utf8, latin1, cp1251, koi8r etc.)
// See http://dev.mysql.com/doc/refman/5.0/en/charset-charsets.html for the full list
$db_connection_charset = '';
// *******************************************************************************************
// If not familiar with PHP please don't change anything below this line
// *******************************************************************************************
if ($ajax)
define ('DATA_CHUNK_LENGTH',16384); // How many chars are read per time define ('MAX_QUERY_LINES',300); // How many lines may be considered to be one query (except text lines) define ('TESTMODE',false); // Set to true to process the file without actually accessing the database
header("Expires: Mon, 1 Dec 2003 01:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false);
@ini_set('auto_detect_line_endings', true);
// Clean and strip anything we don't want from user's input [0.27b]
foreach ($_REQUEST as $key => $val)
{
$_REQUEST[$key] = $val;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>BigDump ver. <?php echo (VERSION); ?></title>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1"/>
<meta http-equiv="CONTENT-LANGUAGE" content="EN"/>
<meta http-equiv="Cache-Control" content="no-cache/"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>
<style type="text/css">
<!--
body
{ background-color:#FFFFF0;
}
h1
{ font-size:20px;
line-height:24px;
font-family:Arial,Helvetica,sans-serif;
margin-top:5px;
margin-bottom:5px;
}
p,td,th
{ font-size:14px;
line-height:18px;
font-family:Arial,Helvetica,sans-serif;
margin-top:5px;
margin-bottom:5px;
text-align:justify;
vertical-align:top;
}
p.centr
{
text-align:center;
}
p.smlcentr
{ font-size:10px;
line-height:14px;
text-align:center;
}
p.error
{ color:#FF0000;
font-weight:bold;
}
p.success
{ color:#00DD00;
font-weight:bold;
}
p.successcentr
{ color:#00DD00;
background-color:#DDDDFF;
font-weight:bold;
text-align:center;
}
td
{ background-color:#F8F8F8;
text-align:left;
}
td.transparent
{ background-color:#FFFFF0;
}
th
{ font-weight:bold;
color:#FFFFFF;
background-color:#AAAAEE;
text-align:left;
}
td.right
{ text-align:right;
}
form
{ margin-top:5px;
margin-bottom:5px;
}
div.skin1
{
border-color:#3333EE;
border-width:5px;
border-style:solid;
background-color:#AAAAEE;
text-align:center;
vertical-align:middle;
padding:3px;
margin:1px;
}
td.bg3
{ background-color:#EEEE99;
text-align:left;
vertical-align:top;
width:20%;
}
th.bg4
{ background-color:#EEAA55;
text-align:left;
vertical-align:top;
width:20%;
}
td.bgpctbar
{ background-color:#EEEEAA;
text-align:left;
vertical-align:middle;
width:80%;
}
-->
</style>
</head>
<body>
<center>
<table width="780" cellspacing="0" cellpadding="0">
<tr><td class="transparent">
<!-- <h1>BigDump: Staggered MySQL Dump Importer ver. <?php echo (VERSION); ?></h1> -->
<?php
function skin_open() {
echo ('<div class="skin1">');
}
function skin_close() {
echo ('</div>');
}
skin_open();
echo ('<h1>BigDump: Staggered MySQL Dump Importer v'.VERSION.'</h1>');
skin_close();
$error = false;
$file = false;
// Check PHP version
{ echo ("<p class=\"error\">PHP version 4.1.0 is required for BigDump to proceed. You have PHP ".phpversion()." installed. Sorry!</p>\n"); $error=true;
}
// Check if mysql extension is available
{ echo ("<p class=\"error\">There is no mySQL extension available in your PHP installation. Sorry!</p>\n");
$error=true;
}
// Calculate PHP max upload size (handle settings like 10M or 100K)
if (!$error)
{ $upload_max_filesize=ini_get("upload_max_filesize"); if (preg_match("/([0-9]+)K/i",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024; if (preg_match("/([0-9]+)M/i",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024*1024; if (preg_match("/([0-9]+)G/i",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024*1024*1024; }
// Get the current directory
if (isset($_SERVER["CGIA"])) $upload_dir=dirname($_SERVER["CGIA"]); else if (isset($_SERVER["ORIG_PATH_TRANSLATED"])) $upload_dir=dirname($_SERVER["ORIG_PATH_TRANSLATED"]); else if (isset($_SERVER["ORIG_SCRIPT_FILENAME"])) $upload_dir=dirname($_SERVER["ORIG_SCRIPT_FILENAME"]); else if (isset($_SERVER["PATH_TRANSLATED"])) $upload_dir=dirname($_SERVER["PATH_TRANSLATED"]); else
$upload_dir=dirname($_SERVER["SCRIPT_FILENAME"]);
// Handle file upload
if (!$error && isset($_REQUEST["uploadbutton"])) { if (is_uploaded_file($_FILES["dumpfile"]["tmp_name"]) && ($_FILES["dumpfile"]["error"])==0) {
$uploaded_filename=str_replace(" ","_",$_FILES["dumpfile"]["name"]); $uploaded_filename=preg_replace("/[^_A-Za-z0-9-\.]/i",'',$uploaded_filename); $uploaded_filepath=str_replace("\\","/",$upload_dir."/".$uploaded_filename);
{ echo ("<p class=\"error\">File $uploaded_filename already exist! Delete and upload again!</p>\n");
}
else if (!preg_match("/(\.(sql|gz|csv))$/i",$uploaded_filename)) { echo ("<p class=\"error\">You may only upload .sql .gz or .csv files.</p>\n");
}
{ echo ("<p class=\"error\">Error moving uploaded file ".$_FILES["dumpfile"]["tmp_name"]." to the $uploaded_filepath</p>\n");
echo ("<p>Check the directory permissions for $upload_dir (must be 777)!</p>\n");
}
else
{ echo ("<p class=\"success\">Uploaded file saved as $uploaded_filename</p>\n");
}
}
else
{ echo ("<p class=\"error\">Error uploading file ".$_FILES["dumpfile"]["name"]."</p>\n");
}
}
// Handle file deletion (delete only in the current directory for security reasons)
if (!$error && isset($_REQUEST["delete"]) && $_REQUEST["delete"]!=basename($_SERVER["SCRIPT_FILENAME"])) echo ("<p class=\"success\">".$_REQUEST["delete"]." was removed successfully</p>\n");
else
echo ("<p class=\"error\">Can't remove ".$_REQUEST["delete"]."</p>\n");
}
// Connect to the database
if (!$error && !TESTMODE)
{ $dbconnection = @mysql_connect($db_server,$db_username,$db_password); if ($dbconnection)
if (!$dbconnection || !$db)
{ echo ("<p class=\"error\">Database connection failed due to ".mysql_error()."</p>\n"); echo ("<p>Edit the database settings in ".$_SERVER["SCRIPT_FILENAME"]." or contact your database provider.</p>\n");
$error=true;
}
if (!$error && $db_connection_charset!=='')
@mysql_query("SET NAMES $db_connection_charset", $dbconnection); }
else
{ $dbconnection = false;
}
// echo("<h1>Checkpoint!</h1>");
// List uploaded files in multifile mode
if (!$error && !isset($_REQUEST["fn"]) && $filename=="") { if ($dirhandle = opendir($upload_dir)) { $dirhead=false;
while (false !== ($dirfile = readdir($dirhandle))) { if ($dirfile != "." && $dirfile != ".." && $dirfile!=basename($_SERVER["SCRIPT_FILENAME"])) { if (!$dirhead)
{ echo ("<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\">\n");
echo ("<tr><th>Filename</th><th>Size</th><th>Date&Time</th><th>Type</th><th> </th><th> </th>\n");
$dirhead=true;
}
echo ("<tr><td>$dir