Hi There,
I've got a simple image upload script which involves a multi-part form:
<form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?id=<?php echo $_GET['id'] ?>">
an image upload:
if ($_POST['imageupload'])
{
$sourcepath = "../photos/gigs/";
//echo "source path:$sourcepath<br />";
$image = jpeg_upload('imageuploaded', $sourcepath);
$thumb = createThumbnail($image, $sourcepath, 200, 100, "_thumb");
$imagetypes = array('/\.gif$/', '/\.jpg$/', '/\.jpeg$/', '/\.png$/');
$imagename = preg_replace($imagetypes, '', $image);
if ($image != '')
{
echo '<img id = "previewimg" src = "../photos/gigs/' . $imagename . '_thumb.jpg" style="max-width:150px; max-height:150px;" />';
}
$date = explode("-", $_POST['date1']);
echo $_POST['title'];
$title = $_POST['title'];
$hours = $_POST['hours'];
$mins = $_POST['mins'];
$venue = $_POST['venue'];
$link = $_POST['link'];
$tickets = $_POST['tickets'];
$details = $_POST['Info'];
$total = (int)$_POST['items'];
$items = array();
for ($i = 0; $i < $total; $i++)
{
$items[$i] = array("composer" => $_POST['composer' . ($i + 1)], "title" => $_POST['title' . ($i + 1)]);
}
}
else
{
$image = '';
$now = date('Y-m-d');
$date = explode("-", $now);
$title = "";
$hours = "";
$mins = "";
$venue = "";
$link = "";
$tickets = '';
$total = 1;
$details = '';
$items = array();
$items[0] = array("composer" => '', "title" => '');
}
echo 'Choose Image file to upload: <input name="imageuploaded" type="file" />';
echo '<input type="submit" name="imageupload" value="Upload File" class = "button"/>';
and some text input boxes:
<input type="text" style="width:300px" value = "<?php echo $title; ?>" name="title" /><br />
Sorry I haven't posted the entire script here - it's too big and probably irrelevant. What my problem is is that when ever I go to upload an image, break characters appear before all the ' and " and \ characters in my text messing it up. Anyone know why this is and how I could stop it?
(p.s checked echo $_POST['title'] and found that that had slashes in it too)
Thanks
Edd