Closed kallekanin closed 7 years ago
@kallekanin the image uploader is expecting a JSON payload back - my guess is you're not returning that from your server side script.
I run this: console.log(file); and that gives me a JSON, but that JSON is not valid (tested in JSONLint).
My browser point out this line for the error: response = JSON.parse(ev.target.responseText);
Hi @kallekanin, CT's ImageUploader example class doesn't itself attempt to create and parse JSON, it only parses JSON that is returned to it from a call to the server. I'm not sure what console.log(file)
is in reference to here?
file uploaded to server, but i still get: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data.
Seams like the JSON format from the callback is formated wrong, even tho the file is uploaded to the server, it wount return valid JSON.
Select image -> upload to server -> error -> image is not visible in the frame.
@kallekanin if the server isn't returning valid JSON then that needs to be resolved but that's beyond the scope of CT. I'll happily take a look at your server code if you post it and see if I can spot the issue but keep in mind I don't know what language or framework your using so I might be of limited help.
The image are uploaded but it wont show in the editing window (added screenshot)
JS code that trigger uploadscript:
$.getJSON('save.php', 'test', function(e){
console.log(e);
});
save.php:
<?php
move_uploaded_file($_FILES['image']['tmp_name'],"images/".$_FILES['image']['name']);
?>
Gives me this message in browser: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data ( editor.js:128:28 )
I get the error: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"
When i click "Upload" button, after selecting a image.
Does anyone know what might be wrong?