Skip to content
This repository has been archived by the owner on Mar 30, 2018. It is now read-only.

Using custom upload #1

Open
mouzofabricio opened this issue Mar 8, 2017 · 4 comments
Open

Using custom upload #1

mouzofabricio opened this issue Mar 8, 2017 · 4 comments

Comments

@mouzofabricio
Copy link

I've been using this plugin and it works perfectly out of the box.
Nevertheless, I'm working in a project with ember-fire (firebase db) and whenever I upload an image it gets embedded as base64 code which makes the upload and download times take forever.

Is there any way to implement a custom upload code so I can set another server to upload the images and generate the urls ?

Thanks!

@willviles
Copy link
Owner

Good question @mouzofabricio. How do you want the uploads to work, exactly?

Medium Editor Insert Plugin uses BlueImp's jQuery File Upload to handle uploads. Unless there's a way you can work its options to do exactly what you want, then I'd be tempted to write a custom addon for Medium Editor Insert Plugin for your specific upload process.

@mouzofabricio
Copy link
Author

Hi Will,
Thanks for your quick response.
Right now I managed to add a url parameter to fileUploadOptions and it actually hits the endpoint correctly but I get an error on the reponse as if it was undefined. From the chrome devtools i see the correct response from the server.
This is the response I send from the "firebase functions":


const data = { 
	  files:
	    [
	      {
	        url : 'https://firebasestorage.googleapis.com/v0/b/babel-77d1f.appspot.com/o/bg_contacto.jpg?alt=media&token=6c661655-d18c-45a1-a30a-ae94d2b37c52'
	      }
	    ]
	};

    res.setHeader('Content-Type', 'application/json');
    res.send(JSON.stringify(data), null, '\t');

And this is the error I'm get in Ember:
Uncaught TypeError: Cannot read property 'files' of undefined

@willviles
Copy link
Owner

Hmm, that payload seems like it should work. Is it responding with a 200 status?

The main problem with Ember Medium Editor Insert Plugin is that there's no method of inspecting or adapting the response before it's handled and inserted into the DOM.

Though there's an open PR #384 to enable you to use the default uploader add and done functions.

@willviles
Copy link
Owner

@mouzofabricio, did you find a good solution? If so, can I close this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants