Hope someone can help with this.
At the moment I have a form that includes an image upload, along with various other fields that get dumped into a database.
The file name is dumped into a File_Name field also, and currently trims it so that only the filename goes into the database rather than the full path,
ie image.jpg instead of c:/pictures/image.jpg
However, we've just noticed an issue whereby truncation is also taking place after the ' character.
ie c:/pictures/bob's photo is dumping s photo instead of bob's photo.
I can't see anything obvious in the code, but find below some snippets :
The upload to server code :
if ( is_uploaded_file($_FILES['uploadFile']['tmp_name']) ) {
$destpath = 'Photos/' . basename($_FILES['uploadFile']['name']);
if (!move_uploaded_file($_FILES['uploadFile']['tmp_name'], $destpath) ) {
echo 'Error moving file ' . $_FILES['uploadFile']['tmp_name'] . ' to ' . $destpath;
}
}
The dump fields into database code :
$FTG_uploadFile = AddSlashes($FTGuploadFile);
$FTG_Title = AddSlashes($FTGTitle);
$FTG_Link_ID = AddSlashes($FTGLink_ID);
$FTG_Supplier = AddSlashes($FTGSupplier);
$FTG_Rights = AddSlashes($FTGRights);
$FTG_Rights_Details = AddSlashes($FTGRights_Details);
$FTG_Credit = AddSlashes($FTGCredit);
$FTG_Image_Size = AddSlashes($FTGImage_Size);
$FTG_Orientation = AddSlashes($FTGOrientation);
$FTG_Year = AddSlashes($FTGYear);
$FTG_Country = AddSlashes($FTGCountry);
$FTG_Admin = AddSlashes($FTGAdmin);
$FTG_Region = AddSlashes($FTGRegion);
$FTG_Easting = AddSlashes($FTGEasting);
$FTG_Northing = AddSlashes($FTGNorthing);
$mysql_link = @mysql_connect("localhost", "root", "Fishnish");
if (mysql_errno() == 0) {
@mysql_select_db("photolibrary", $mysql_link);
}
if (mysql_errno() == 0) {
$sqlcmd = "INSERT INTO photos(Photo_File, Title, Link_ID, Supplier, Rights, Rights_Details, Credit, Image_Size, Orientation, Year, Country, Admin, Region, Easting, Northing) VALUES('$FTG_uploadFile', '$FTG_Title', '$FTG_Link_ID', '$FTG_Supplier', '$FTG_Rights', '$FTG_Rights_Details', '$FTG_Credit', '$FTG_Image_Size', '$FTG_Orientation', '$FTG_Year', '$FTG_Country', '$FTG_Admin', '$FTG_Region', '$FTG_Easting', '$FTG_Northing')";
@mysql_query($sqlcmd, $mysql_link);
$Photo_ID = mysql_insert_id ();
}
Any ideas what I need to modify / add to stop it truncating after ' ?