jamesmargolis Posted November 25, 2014 Share Posted November 25, 2014 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 someoneadvises me to, I will move that question and put it in the appropriate forum. Quote Link to comment https://forums.phpfreaks.com/topic/292704-uploading-from-one%E2%80%99s-own-computer-internet/ Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2014 Share Posted November 25, 2014 now I need a pop-up window that allows the user to choose first if he uploads from his computer or from the internet. What do you mean by the term "from the internet" Quote Link to comment https://forums.phpfreaks.com/topic/292704-uploading-from-one%E2%80%99s-own-computer-internet/#findComment-1497637 Share on other sites More sharing options...
jamesmargolis Posted November 25, 2014 Author Share Posted November 25, 2014 (edited) 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 November 25, 2014 by jamesmargolis Quote Link to comment https://forums.phpfreaks.com/topic/292704-uploading-from-one%E2%80%99s-own-computer-internet/#findComment-1497639 Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2014 Share Posted November 25, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/292704-uploading-from-one%E2%80%99s-own-computer-internet/#findComment-1497652 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.