UPLOAD --- PLS HELP - [REZOLVAT]

PEAR, Smarty, ADOdb, OOP, PHP 5, XML, UML, Şabloane de proiectare, PHP-GTK.

Moderatori: coditza, Emil, Moderatori

Pushtiu
Average Member
Mesaje: 69
Membru din: Mie Dec 06, 2006 1:03 pm
Contact:

UPLOAD --- PLS HELP - [REZOLVAT]

Mesajde Pushtiu » Lun Aug 20, 2007 9:49 pm

e pus de 2 ori ...imi cer scuze da la incepatori nu am rezolvat problema..poate aici ....HELP ME PLS!!!

Conform codului de mai jos datele sunt introduse in baza de date separat o data numle pozei si di link-ul si apoi datele ...dar eu vteau toate o singura data si sa-i coresunda un singur ID

poate cineva sa ma ajute va rog

code: <?php
$name = $_POST['name'];
$name = trim($name);
$name=strip_tags($name);
$name = str_replace(" ","",$name);
$name=str_replace("%20","",$name);
$name=addslashes($name);
// Where the file is going to be placed temporarly
$target_path = "tmp_poze/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

$_FILES['uploadedfile']['tmp_name']; // temp file

$target_path = "poze/";
$oldfile = basename($_FILES['uploadedfile']['name']);

// getting the extention
$pos = strpos($oldfile,".",0);
$ext = trim(substr($oldfile,$pos+1,strlen($oldfile))," ");
function generate($length=8)
{
$key="";
$num_array = ("123456789");

for($i=0; $i<$length; $i++)
{
mt_srand((double)microtime()*1000000);
$randNum=mt_rand(0,8);
$key.=$num_array[$randNum];
}
return $key;
}
$tm=generate();
//new file name example for a profile image of a user
$newfile = $name ."_" . $tm . "." . $ext;

// move the file to the final destination
$target_path = $target_path . basename($newfile);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "Fisierul ". basename( $_FILES['uploadedfile']['name']). " a fost adugat!";
$sql = "INSERT INTO formular SET name='$name' , dir='$target_path'";
mysql_query($sql) or die(mysql_error());

} else{
echo "EROARE... incearca din nou!";
}
$_SESSION['nume'] = $_POST['nume'];
$_SESSION['prenume'] = $_POST['prenume'];
$_SESSION['nanterior'] = $_POST['nanterior'];
$_SESSION['cetatenie'] = $_POST['cetatenie'];
$_SESSION['starecivila'] = $_POST['starecivila'];
$_SESSION['name'] = $_POST['name'];
$_SESSION['dir'] = $_POST['target_path'];
Ultima oară modificat Vin Aug 24, 2007 8:06 am de către Pushtiu, modificat 1 dată în total.



Avatar utilizator
Mascka
Senior Member
Mesaje: 1376
Membru din: Sâm Oct 01, 2005 8:00 am
Localitate: Braila
Contact:

Mesajde Mascka » Mar Aug 21, 2007 9:56 am

or

crivion
Senior Member
Mesaje: 781
Membru din: Mar Apr 10, 2007 4:20 pm
Localitate: Somewhere

Mesajde crivion » Mar Aug 21, 2007 11:06 am





Avatar utilizator
kyron
Senior Member
Mesaje: 639
Membru din: Joi Sep 16, 2004 1:12 pm
Localitate: Bucuresti
Contact:

Mesajde kyron » Mar Aug 21, 2007 1:02 pm


crivion
Senior Member
Mesaje: 781
Membru din: Mar Apr 10, 2007 4:20 pm
Localitate: Somewhere

Mesajde crivion » Mar Aug 21, 2007 1:38 pm

atunci adauga un where







Avatar utilizator
Mascka
Senior Member
Mesaje: 1376
Membru din: Sâm Oct 01, 2005 8:00 am
Localitate: Braila
Contact:

Mesajde Mascka » Mar Aug 21, 2007 9:52 pm

or

Pushtiu
Average Member
Mesaje: 69
Membru din: Mie Dec 06, 2006 1:03 pm
Contact:

Mesajde Pushtiu » Mie Aug 22, 2007 10:02 am


Avatar utilizator
Mascka
Senior Member
Mesaje: 1376
Membru din: Sâm Oct 01, 2005 8:00 am
Localitate: Braila
Contact:

Mesajde Mascka » Mie Aug 22, 2007 6:33 pm

or


Înapoi la “PHP Avansat”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 2 vizitatori