Buenas chicos
os voy a dar una buena noticia
justo lo que quieres hacer se puede hacer con PHP
jeje eso si con PHP5 ya que tiene incorporado un nuevo sistema (mejorado) de upload de archivos. Aqui os dejo un code que vi en su dia en una web (no la recuerdo):
Código PHP:
<?
$close_popup_window_when_done = 1;
function read_progress_metter() {
$X = array (
"time_start" => 0,
"time_last" => 0,
"speed_average" => 0,
"speed_last" => 0,
"bytes_uploaded" => 0,
"bytes_total" => 1,
"files_uploaded" => 0,
"eta" => 0
);
$file = get_progress_metter_file();
if (!$file) return FALSE;
$F = @fopen($file, "r");
if (!$F) return $X;
while (!feof ($F)) {
$buffer = fgets($F, 100);
if (preg_match('/(\w+)=(\d+)/', $buffer, $matches)) {
$X[$matches[1]]=$matches[2];
}
}
fclose($F);
return $X;
}
function remove_progress_metter_file() {
$file = get_progress_metter_file();
if (!$file) return;
unlink($file);
}
function get_progress_metter_file() {
$id = $_GET["UPLOAD_METTER_ID"];
$dir = ini_get('upload_metter_dir');
if (!isset($id)) return FALSE;
if (!isset($dir)) return FALSE;
if (!$dir) return FALSE;
if (!$id) return FALSE;
// if (preg_match('/[\'\"\`\/\\\?\*\&\^]|\.\./', $id)) { ## cannot contain .. or '"`?*&^ or /-es or \-es
if (preg_match('/[\'\"\`]|\.\./', $id)) { ## cannot contain .. or '"`?*&^ or /-es or \-es
return "";
}else{
return "$dir/$id";
}
}
function nice_value($x) {
if ($x < 100) $x;
if ($x < 10000) return sprintf("%.2fKB", $x/1000);
if ($x < 900000) return sprintf("%dKB", $x/1000);
return sprintf("%.2fMB", $x/1000/1000);
}
$X = read_progress_metter();
if (!$X) {
echo ('<HTML><BODY '. ($close_popup_window_when_done ? ' onLoad="window.close()"' : ''). ' > Invalid metter ID!</BODY></HTML>');
}else{
$metter = sprintf("%.2f", $X['bytes_uploaded'] / $X['bytes_total'] * 100);
$sp = $X['speed_last'];
if ($sp < 10000) $speed = sprintf("%.2f", $sp / 1000);
else $speed = sprintf("%d", $sp / 1000);
$eta = sprintf("%02d:%02d", $X['eta'] / 60, $X['eta'] % 60 );
$upl = nice_value($X['bytes_uploaded']);
$total = nice_value($X['bytes_total']);
if ($X['bytes_total'] > 1 && $X['bytes_uploaded'] >= $X['bytes_total'] && $X['eta'] == 0) {
echo ('<HTML><BODY '. ($close_popup_window_when_done ? ' onLoad="window.close()"' : ''). ' > UPLOAD completed!</BODY></HTML>');
remove_progress_metter_file();
}else{
?>
<HTML>
<HEAD>
<meta HTTP-EQUIV="Refresh" CONTENT="1">
<TITLE>Uploading Files... Please wait ...</TITLE>
<style type='text/css'> td {font-size: 10pt } td.uplmtr {font-size:6pt; height:12px}</style>
</HEAD>
<BODY BGCOLOR="#C0C0C0">
Uploading files...
<table border=1 WIDTH="100%" cellPadding=0 cellSpacing=0 style='BORDER-BOTTOM: 0px inset; BORDER-LEFT: 0px inset; BORDER-RIGHT: 0px inset; BORDER-TOP: 0px inset'> <tr><td>
<table border=0 WIDTH="100%" COLS="34"><tr>
<?
for ($i=0; $i<100; $i+=3) {
$color = ($i<$metter) ? " bgcolor='#00007F' " : '';
$width = ($i+3<100) ? "3" : 100-$i;
echo("<td $color class='uplmtr' WIDTH='$width%'> </td>\n");
}
?>
</tr></table>
</td></tr></table>
<TABLE WIDTH=100%><TR><TD>
<?=$eta?> left (at <?=$speed?>KB/sec)
</TD><TD ALIGN=right>
<?=$upl?>/<?=$total?>(<?=$metter?>%)
</TD></TR><TR><TD>
</TD></TR></TABLE>
</BODY>
</HTML>
<? } } ?>
Y aqui el formulario
Código PHP:
<?
$id = rand() . '.' . time();
$upl = ini_get('upload_metter');
$dir = ini_get('upload_metter_dir');
?>
<HTML>
<HEAD>
<TITLE>Upload test </TITLE>
</HEAD>
<BODY>
generated new UPLOAD_METTER_ID = <?=$id?> <br>
php-config.upload_metter = <?=$upl?> <br>
php-config.upload_metter_dir = <?=$dir?> <br>
<P><FORM METHOD="POST" ENCTYPE="multipart/form-data"
onSubmit="window.open('progress.php?UPLOAD_METTER_ID=<?=$id?>','UploadMetter','width=370,height=115', true); return true; "
action="upload_done.php"
>
<input type=hidden name=UPLOAD_METTER_ID value="<?=$id?>">
Select File 1: <INPUT TYPE="file" NAME="filename1" VALUE=""><br>
Select File 2: <INPUT TYPE="file" NAME="filename2" VALUE=""><br>
Select File 3: <INPUT TYPE="file" NAME="filename3" VALUE=""><br>
Select File 4: <INPUT TYPE="file" NAME="filename4" VALUE=""><br>
Select File 5: <INPUT TYPE="file" NAME="filename5" VALUE=""><br>
<P><INPUT TYPE="submit">
</FORM>
<hr>
<a href="http://pdoru.from.ro/upload-progress-metter.v2.tgz">Download upload-progress-metter.v2.tgz</a>
</BODY></HTML>
Jeje pero para eso tendremos que esperar a PHP5 :P un saludillo!!!