Hi,
I have a page that uploads an image to a folder and sets the value in the database. What I need is when renaming the file to remove any spaces or 'bad' characters. I am guessing that if I do this for the imagefile then the variable that gets posted to the database will be rid of these as a result (which I guess solves half my problem from the title)...
Here is the code:
if ($_FILES['imagefile']['type'] == "image/gif"){
copy ($_FILES['imagefile']['tmp_name'], "files/".$username.$_FILES['imagefile']['name'])
or die ("Could not copy");
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Upload Complete....";
$image1 = $username.$_FILES['imagefile'] ['name'];
echo "$image1";
$query = "UPDATE `suppliers`
SET `image1` = '$image1' WHERE `username` = '". mysql_real_escape_string($_SESSION['username']). "'
LIMIT 1";
$result = mysql_query($query, $link) or die('Update failed: ' . mysql_error());
etc, etc
Thanks,
G