/    Sign up×
Community /Pin to ProfileBookmark

Upload image using URL

I want to allow a user to upload an image in one of two methods:
1) File upload
2) User, supplies a URL to somewhere in the web, and the page gets the image from there. Note, I want to upload, not just display it.

The first method is pretty straight forward and is covered all over the web. The second method not so much.
Should the client get the image and upload it like a file, or should I make the server side go to the web? If the former is the better way, how do I accomplish that?

thx

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@cgishackJan 19.2008 — Wrong language,

See a s[B]erver side language[/B] such as php, perl or asp.net

JavaScript is a [B]client side language[/B]

Drew
Copy linkTweet thisAlerts:
@devboyauthorJan 19.2008 — When I said the first method is straight forward I thought it obvious I have a server (php) and that I already did upload a file using the conventional method. That is NOT the question.

You can basically handle the task I describe in two ways... Have the server side go fetch the file from the web or have the client side do it for the server side. I asked which is better. Now ignore for a second which way is better, what I'm asking is how using javascript do I capture the click event on a button submit, go to the web, get an image url, save it locally and then upload it from the local file system (browser cache most likely) as if it was browsed and uploaded using an <input type="file>?
Copy linkTweet thisAlerts:
@cgishackJan 19.2008 — Sorry. I read too quickly.

If it was me, i would stick to pure server side for this.


Drew
×

Success!

Help @devboy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,
)...