1

I want users to be able to add a photo to a page by giving its URL. I want to both display it and save the image on my server. Can I do this using AJAX, and ideally with Jquery?

I'm currently using the Jquery File Upload plugin to handle uploads from the user's computer, however I could not find a way of using it to handle upload by URL.

3
  • Yes you can do this. AJAX the URL of the image up to your server-side script that downloads the image, and then add the image code on the client browser. Commented Aug 21, 2013 at 18:45
  • couldn't you add the photo to the page just by writing in an img tag with that URL as the src? -- just saw your edit, you want to save it to your server too. That would have to be done on the back-end. Commented Aug 21, 2013 at 18:47
  • I just edited the question to say that I want to save the image too. Otherwise displaying it by writing out the img tag would work. Commented Aug 21, 2013 at 18:49

1 Answer 1

4

If it's just a URL, you can send the URL to the server and make it download the image, instead of sending the whole image in AJAX.

Sign up to request clarification or add additional context in comments.

1 Comment

What happens if it's a local url?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.