Home Tutorial Php Examples Create a directory in php


Share on Google+Share on Google+
Create a directory in php
Posted on: July 30, 2009 at 12:00 AM
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" "http://www.w3.org/TR/html4/loose.dtd">
<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> 


Related Tags for Create a directory in php:

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.

Posted on: July 30, 2009

Recommend the tutorial

Advertisements Advertisements