Jump to content

Image Replace


Pandareen

Recommended Posts

or not:

 

here it is:

 


mysql_query( "INSERT INTO `softmarket`.`internet_securitate` (`internet_securitateID`, `nume_produs`, `descriere`, `versiune`,`poza`, `pret`, `disponibilitate_produs`) 
VALUES ('', '$_POST[titlu]', '$_POST[descriere]', '$_POST[versiune]', '$foto', '$_POST[pret]', '$_POST[disponibilitate]');");

mysql_query("INSERT  `softmarket`.`internet_securitate` SET  `val`=$foto WHERE  `internet_securitate`.`internet_securitateID` = ;");

function findexts ($filename) { 
$filename = strtolower($filename) ; 
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1; $exts = $exts[$n]; 
return $exts; } 


$ext = findexts ($_FILES['foto']['name']) ; 

$ran2 = $poza."."; 

$target = "../images/";

$target = $target . $ran2.$ext; 
if(move_uploaded_file($_FILES['foto']['tmp_name'], $target))  { 
echo "The file has been uploaded as ".$ran2.$ext; } 

else { echo "Sorry, there was a problem uploading your file."; } 



header('Location: succes.php');
mysql_close($con);

Link to comment
https://forums.phpfreaks.com/topic/254363-image-replace/#findComment-1304280
Share on other sites

like this?

 

$target_path = "images/";

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

if(move_uploaded_file($_FILES['foto']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['foto']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
} 

 

i don't know how to rename it :-s

Link to comment
https://forums.phpfreaks.com/topic/254363-image-replace/#findComment-1304295
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.