Jump to content

Uploading from one’s own computer & internet


jamesmargolis

Recommended Posts

I know about

<input type="file" >

which allows one to upload files from one’s computer. But
 now I need a pop-up window that allows the user to choose first if he uploads from his computer or from the internet. How may I achieve that ?

  This question is perhaps better suited for the "Javascript" or even "AJAX" forum ; if someone
advises me to, I will move that question and put it in the appropriate forum.
 

Link to comment
Share on other sites

What do you mean by the term "from the internet"

 

From a dropbox or an online image repository, for example.

If the user chooses to upload "from his computer", everything will work as with an ordinary "input type="file"".

If the user chooses to upload "from the web", he is to be provided a text field in which he will type the URL of the image/audio/video.

 

I know this is something already implemented in many sites ; for example, if you click on the image icon in the panel at http://math.stackexchange.com/questions/ask, you get exactly what I am looking for

Edited by jamesmargolis
Link to comment
Share on other sites

You'd need to use Javascript. When the Computer radio button is clicked show the file field. If the Web radio button is click show the textbox.  

Here is an example using Jquery:

http://jsfiddle.net/d1n9xLwz/

 

NOTE: Only the file input field will upload the file to your server! The text field for entering the url to the file will only submit what was entered into it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.