veda-consulting-company / uk.co.vedaconsulting.mosaico

Other
39 stars 75 forks source link

Unexpected upload error (SyntaxError: Unexpected token < in JSON at position 0) #53

Closed jmcheung closed 7 years ago

jmcheung commented 8 years ago

We get this error using the extension. It occurs when you upload an image to the template.

Is there a quick fix, have we done something wrong?

rocxa commented 8 years ago

This is usually caused by the image folders 'uploads' 'uploads/images' 'uploads/images/static' 'uploads/images/thumbnails' on the server not existing or not being writable.

On 14 October 2016 at 16:52, jmcheung notifications@github.com wrote:

We get this error using the extension. It occurs when you upload an image to the template.

Is there a quick fix, have we done something wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/53, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRoCXy2xE6wugdHwTJrtgvAD7L_rh0Iks5qz6U-gaJpZM4KXKTu .

jmcheung commented 8 years ago

hi @rocxa that was quick!

We have 'public_html/sites/default/files/civicrm/persist/contribute/images' in our Drupal/CiviCRM site

Does it need these additional directories in there?

rocxa commented 8 years ago

Yes, that sounds like the right place for a standard CiviCRM.

You probably just need the images/static and images/thumbnails directories creating. We have added the 'uploads' level directory to our site.

The extension should create these directories, I haven't looked into why it doesn't sometimes.

On 14 October 2016 at 16:58, jmcheung notifications@github.com wrote:

hi @rocxa https://github.com/rocxa that was quick!

We have 'public_html/sites/default/files/civicrm/persist/contribute/images' in our Drupal/CiviCRM site

Does it need these additional directories in there?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/53#issuecomment-253843025, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRoCTWAIHBcgGcrUQzG6h-zNUy_l5Gxks5qz6acgaJpZM4KXKTu .

deepak-srivastava commented 8 years ago

Yep extension should be creating those directories. Is it an old install and you upgraded? If yes might want to re-install. Or otherwise we need to look into where its failing.

I think we should add all dir checks anyway with the runcheck - https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/blob/master/CRM/Mosaico/Page/Index.php#L28

jmcheung commented 8 years ago

I created these directories manually and still no good: - sites/default/files/civicrm/persist/contribute/images/static sites/default/files/civicrm/persist/contribute/images/thumbnails

should they be 755 permissions?

rocxa commented 8 years ago

Do you have any watchdog/civilog errors showing you where mosaico is trying to upload the images? It sounds like it isnt the directory it appears to be.

I have created a PR that moves the directory mosaico uses for images to the same one civimail image browser uses. You might want to try that.

On 14 Oct 2016 19:05, "jmcheung" notifications@github.com wrote:

I created these directories manually and still no good: - sites/default/files/civicrm/persist/contribute/images/static sites/default/files/civicrm/persist/contribute/images/thumbnails

should they be 755 permissions?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/53#issuecomment-253877512, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRoCfYLMSdiihrfwfL9WPi4ymzKpQ8Pks5qz8RvgaJpZM4KXKTu .

rocxa commented 8 years ago

54 (now merged)

rocxa commented 8 years ago

57 (waiting for testing/merge)

New PR auto creates the directories (amongst other things) so may help with this issue as well.

totten commented 7 years ago

The first PR mentioned (54) is merged, and the second PR was resubmitted and then merged (65).