I have below code:
<!Doctype html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"> </script>
<script type="text/javascript" src="uploadify/jquery.uploadify.min.js"></script>
<script>
function deleteFile(file_name) {
alert("Hello " + file_name);
}
$(function() {
$('#file_upload').uploadify({
'removeCompleted' : false,
'fileTypeDesc' : 'Image Files',
'fileTypeExts' : '*.gif; *.jpg; *.png',
'method' : 'post',
'queueSizeLimit' : '5',
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadimage.cgi',
'uploadLimit' : '5',
'onUploadSuccess': function(file, data, response) {
$(".imgpreview").append("<img src=\"" + data + "\" id=\"i" + file.id + "\" height=\"100px\" width=\"100px\" /><a onclick=\"alert('" + data + "')\">X</a>");
},
});
});
</script>
<link rel="stylesheet" type="text/css" href="uploadify/uploadify.css" />
</head>
<body>
<input type="file" name="file_upload" id="file_upload" />
<div class="imgpreview" id="imgpreview" style="height:100px;width:500px;border:2px solid;">
</div>
</body>
</html>
Here after uploading the image when 'X' appears beside the images on the screen. After clicking on the link 'X' I am receiving "Uncaught SyntaxError: Unexpected token ILLEGAL" in Chrome and "SyntaxError: unterminated string literal" in Firefox. Please help in finding mistake.
datacontains an apostrophe, your code breaks horribly. - Niet the Dark Absolconsole.logonfileanddatabefore the$(".imgpreview").appendline to make sure they're coming through as expected. - mralexlau