Zreddx
Zreddx

Reputation: 35

How do you add a button which opens a page in a pop-up window

I am working on a PHP file upload, but I want the button which opens my uploading page to open it in an pop up window. So it would be like many sites do it, press a button and It opens a pop up where you can upload files.

Here is a code that I tried and it didn't work:

<a href="upload.html" target="_blank">
<input type="button" class="button" value="Upload" />

Upvotes: 1

Views: 69

Answers (3)

Vishal Mohan
Vishal Mohan

Reputation: 29

see link-- https://jsfiddle.net/mu3ju64c/1/

<input type="button" value="Open a Popup Window" onclick="window.open('https://www.google.com/javascript/examples/sample_popup.cfm','popUpWindow','height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');">

  <p> ----------------------according to your code----------------- </p>
<a href="upload.html" target="_blank">
<input type="file" class="button" value="Upload" />

Upvotes: 0

Mike
Mike

Reputation: 71

Try making the input type="file". Example: input type="file" name="myFile"

If you want to style/change the default button you can by doing so...
read this> custom file upload button

Also close your a tag if your still going to do it that way.

Upvotes: 0

Prashanth kumar
Prashanth kumar

Reputation: 985

You have to use type=file

<a href="upload.html" target="_blank">
<input type="file" class="button" value="Upload" />

Upvotes: 1

Related Questions