Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use non-cdn urls with the widget #129

Closed
jjf21 opened this issue Apr 20, 2023 · 1 comment
Closed

Use non-cdn urls with the widget #129

jjf21 opened this issue Apr 20, 2023 · 1 comment
Labels

Comments

@jjf21
Copy link

jjf21 commented Apr 20, 2023

Question

We have a model where the attachment receipt_url is a AWS S3 url.
We would like to use the uploadcare-widget with this url. But as far as I understand the uploadcare-widget is only working with uploadcare cdn urls.

My question is:
Could the uploadcare-widget (single-file) be mounted with a non-cdn url ? (right now it says "Incorrect Value")

Thanks !

@jjf21 jjf21 added the question label Apr 20, 2023
@optlsnd
Copy link

optlsnd commented Apr 20, 2023

Hi @jjf21 , you can use the widget's API to programmatically upload a file from an S3 URL and feed the upload to the widget as a default value:

const url = "https://acme.com/image.jpg";
const widget = uploadcare.Widget("[role=uploadcare-uploader]");

const file = uploadcare.fileFrom("url", URL, {
  publicKey: "YOUR_PUBLIC_KEY"
});

widget.value(file);

@rsedykh rsedykh closed this as completed Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants