I've been getting this weird error and I just can't figure it out
Here is my current code:
function addBackground() {
var penguin_id = getPenguinID();
var file = $('#image_form')[0].files[0];
console.log('Image Getting Uploaded');
var formData = new FormData();
formData.append('file', file);
$.ajax({
url: "custBG.php",
type: "POST",
data: formData,
cache: false,
contentType: false,
processData: false,
mimeType: 'multipart/form-data'
}).done(function(data) {
if (data.status == 0) {
console.log('Image Has Been Uploaded');
addBGItem(70000 + penguin_id);
} else {
console.log(data.message);
}
});
}
Here is the form
<form id="image_form">
<div class="left">
<img id="img-uploaded" src="http://dummyimage.com/210x210/dbdbdb/7e7f80.png" alt="your image" />
</div>
<div class="right">
<input type="file" name="imageToUpload" accept=".png,.jpeg,.jpg,.gif" onchange="validate_image()">
<span class="btn btn-large btn-alpha" onclick="addBackground()">Upload Image</span>
</span>
</div>
</form>
I'm not sure what's up but can anyone help me out with the problem.