View Single Post

(#3 (permalink))
Old
samy4ever samy4ever is offline
Junior Member
samy4ever is on a distinguished road
 
Posts: 6
Join Date: May 2008
Default 07-15-2008, 02:53 PM

uhm... I dunno if you still have this problem but I had some problems too and I manage to solve it luckily.

Here is my code:

Code:
//datos del arhivo -1-
$namefile1 = $_FILES['userfile']['name'];
$typefile1 = $_FILES['userfile']['type'];
$lengthfile1 = $_FILES['userfile']['size'];

//datos del arhivo -2-
$namefile2 = $_FILES['userfile2']['name'];
$typefile2 = $_FILES['userfile2']['type'];
$lengthfile2 = $_FILES['userfile2']['size'];


$ini=$year1."-".$month1."-".$day1;
$fin=$year2."-".$month2."-".$day2;
$ini=strtotime($ini,0);
$fin=strtotime($fin,0);
$period = $fin-$ini;
$period = floor($period/86400);

// Si el tipus del fitxer és correcte i tenim dos fitxers, podem procedir
if (($typefile1 != "text/plain") || ($typefile2 != "text/plain")) {	echo "<br>File type wrong. You will be redirected in 5 seconds. Please, wait... <br><meta http-equiv='refresh' content='5;URL=http://samybux.site88.net'>";	} else {	
if ($period == 0) {	echo "<br>Your files are from the same day. It doesn't make sense. Please, enter two files with different dates. You will be redirected in 5 seconds, wait... <br><meta http-equiv='refresh' content='5;URL=http://samybux.site88.net'>";	} else {	
// Preparem nom dels fitxers a pujar al servidor i carguem el contador
$Counter = file("counter.txt"); 		// La variable cargada es UN STRING.
$fitxer1 = $Counter[0] . ".1." . $namefile1;
$fitxer2 = $Counter[0] . ".2." . $namefile2;

// Comprovem que s'hagi pujat correctament
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $fitxer1)) {   /* echo "El fichero 1 ha sido cargado correctamente.<br>"; */	} else {    echo "ERROR uploading your file nº 1. Try it again.";	}
if (move_uploaded_file($_FILES['userfile2']['tmp_name'], $fitxer2)) {   /* echo "El fichero 2 ha sido cargado correctamente.<br>"; */	} else {	echo "ERROR uploading your file nº 2. Try it again.";   }

............

I hope it helps!
Reply With Quote