PHP's Simple File management (basic function)

Source: Internet
Author: User

PHP's Simple File management (basic function)

First do a simple view of the file function, files and folders are displayed, but double-click the folder can display the next level of subdirectories, double-click < return to the previous level > can return to the previous level of the directory

<!doctype html>The following returns the previous level of $ (". Prev"). DblClick (function () {var url = $ (this). attr ("LJ"); $.ajax ({url: "chuli.php", Data:{url:url},type : "POST", DataType: "TEXT", Success:function (r) {window.location.href = "test.php";}})
To delete plus Click event $ (". SC"). Click (function () {var LJ = $ (this). attr ("LJ"); $.ajax ({url: "shanchu.php", Data:{lj:lj},type: "POST ", Success:function (R) {dataType:" TEXT ", window.location.href =" test.php ";});})

New Button $ ("#newf"). Click (function () {var name = $ ("#name"). Val ();//The user entered the file name $.ajax ({url: "xinjian.php", Data:{name:name },type: "POST", Success:function (R) {dataType: "TEXT", window.location.href = "test.php";});}) </script>

processing page :chuli.php

<?phpsession_start ();//The Writing of the page (cannot use post or get to pass value, can be used to pass the value of the session value is better). Session_Start (); To write at the top of PHP = $_post["url"];$_session["url"] = $url;? >

Delete Processing page :shanchu.php

<?PHP$LJ = $_post["LJ"];unlink ($LJ);? >

New Processing page :xinjian.php

<?php
Session_Start ();
$name = $_post["name"];//fetch to the parent directory. Create a file based on the parent directory. Get the name passed over

$url = $_session["url"];//takes the URL from $_session["url"]. Location of saved paths

$filename = $url. " /". $name;//He is the name file name. Piece together a full path

Touch ($filename);//New File Method Touch ()


?>

Simple File Management for PHP (basic functionality)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.