Share on Google+Share on Google+

Create a directory in php

You will learn here about creating a directory in php.

Creating a directory in php

In  this example, you will learn to create a form in HTML and call php action function of creating directory in HTML form.

For this, first create an action form in HTML and call the php function in the form to create a directory. In PHP, you can create a directory using mkdir() function, and apply it into printing in the HTML form. See the example:

The PHP Code

$uploaddir = $name;
print "created";

The HTML Form

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<head><title>Create Directory</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body > 
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<table style="border:1px solid #CCCCCC; background-color:#F0F0F0; font-family:verdana; font-size:12px" cellpadding="5" cellspacing="2" width="600px"> 
<td><input type="text" id="destination" name="destination"></td>
<td> </td><td><input type="submit" name="create" value="Create"/></td> 



Posted on: July 30, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null