-2

I want to make a file when the link is clicked. Can I do this using PHP?

<a href="C:./Program Files">Click Here</a>
Jack Bashford
  • 43,180
  • 11
  • 50
  • 79
  • 2
    This piece of code is pure html, not php. html is only a markup language and not supposed to manipulate files on the disk (either on the server or on the client side). You will have to include some proper php code to make this happen on the server side. To make it happen on the client side, you will probably require JavaScript or so. Please clarify which of the two you want. – 0range Dec 04 '18 at 17:30
  • This is probably a duplicate of either of the following questions on [creating directories with php](https://stackoverflow.com/q/2303372/1735215) or [creating directories with javascript](https://stackoverflow.com/q/36538377/1735215) – 0range Dec 04 '18 at 17:34
  • Possible duplicate of [Create a folder if it doesn't already exist](https://stackoverflow.com/questions/2303372/create-a-folder-if-it-doesnt-already-exist) – 0range Dec 04 '18 at 17:36

1 Answers1

0

Use a form to do this and when it is submitted direct it to the php script that will create the file.

<form method="post" action="/make_file.php">
    <input type="submit" Value="Click here">
</form>
Jordan Savage
  • 196
  • 2
  • 16
  • It should be noted that you'd be creating the file **on the .php file's server**, not the user's computer. – ceejayoz Dec 05 '18 at 21:42
  • No. I posted that simply as a clarification, and did not downvote you. Careful slinging accusations without evidence. – ceejayoz Dec 05 '18 at 22:42