Im having some problems in my code below , the file uploads no problem , the string replace only works on the data written to the tblZ_Img , but not the actual image being uploaded.
example:
original file name on my hd name is
Te sst.jpg
I use the script below to upload it
its name is written into the db table as
Te**sst.jpg
but is still uploaded into the servers directory as
Te sst.jpg
Rather than helping my cause it makes it worse because the entry on the db is different to the actual file so its now a broken link. I mean all i wanted to do really was to strip the white space from the images name when uploading ..
I thought this would work ,can someone please modify the code below so it does what I want it to . much appreciated.
Thanks
example:
original file name on my hd name is
Te sst.jpg
I use the script below to upload it
its name is written into the db table as
Te**sst.jpg
but is still uploaded into the servers directory as
Te sst.jpg
Rather than helping my cause it makes it worse because the entry on the db is different to the actual file so its now a broken link. I mean all i wanted to do really was to strip the white space from the images name when uploading ..
I thought this would work ,can someone please modify the code below so it does what I want it to . much appreciated.
Thanks
Code:
$file_image = $HTTP_POST_FILES['file_image']['name'];
$file_image = str_replace(" ","*",$file_image);
$date = date("j F Y");
$add =MYSQL_QUERY("INSERT INTO tblZ_Img (id,title,date,image,name,description,file_image)". "VALUES
('NULL', '$title', '$date', '$image','$name','$description','$file_image')");
//success...
copy($HTTP_POST_FILES['file_image']['tmp_name'],"images/".$HTTP_POST_FILES['file_image']['name']);
unlink($HTTP_POST_FILES['file_image']['tmp_name']);
echo("Description Added!");
?>