I am getting an invalid regular expression flag w error stating this:
Notice: Undefined Variable: image_file_name in web/stud/…
In view source it is pointing to a blank space underneath this line of code.
var image_file_name = <?php echo json_encode($image_file_name); ?>;
So how can this error be removed from the error console?
Below is the javascript function where the line of code is displayed:
var _cancelimagecounter = cancelimagecounter;
$(".imageCancel").click(function() {
var image_file_name = <?php echo json_encode($image_file_name); ?>;
$('.upload_target').get(0).contentwindow
$("iframe[name='upload_target']").attr("src", "javascript:'<html></html>'");
jQuery.ajax("cancelimage.php?fileImage=" + image_file_name)
.done(function(data) {
$(".imagemsg" + _cancelimagecounter).html(data);
});
return stopImageUpload();
});
Below is the php code where it retrieves the variable $image_file_name.
<?php
...
$image_file_name = $_GET["fileImage"];
echo "File Upload was Canceled";
$imagecancelsql = "DELETE FROM Image
WHERE ImageFile = 'ImageFiles/". mysql_real_escape_string($image_file_name)."'";
mysql_query($imagecancelsql);
mysql_close();
?>
Look at all your quotes, you have another misplaced quote in your code along with misplaced quotes in
var image_file_name = '<?php echo $image_file_name; ?>';