A few questions for beginners

Source: Internet
Author: User
A few questions for beginners! First, let me explain the situation. The basic functions of PHP can be to display files in the directory. you can upload and download files. you can click here to view the files and return to the previous directory. 1. the header download function can only download files from the root directory. files in subdirectories under the root directory cannot be downloaded. how can I modify the function to download objects in the subdirectories? 2. how can I create a button for beginners!
First, let me explain the situation. The basic functions of PHP can be to display files in the directory. you can upload and download files. you can click here to view the files and return to the previous directory.
1. the header download function can only download files from the root directory. files in subdirectories under the root directory cannot be downloaded. how can I modify the function to download objects in the subdirectories?
2. how to create a button or link so that the button is displayed as the previous page after the button is clicked.
3. how can I restrict the viewing of only the contents in the root directory? I cannot return the upper-level contents in the root directory.
I hope the experts can give you some code to explain that I still won't write my answers!

------ Solution --------------------
I can't solve it. I want to reply to this post. I hope someone else can give me some advice and I want to learn it. after reading it for a few days, I really can't understand it ......
------ Solution --------------------
2: This is paging...
------ Solution --------------------
Are you going to ask someone to write one for you?

You post the code you need to modify so that everyone can raise their comments.
------ Solution --------------------
Paste the code
------ Solution --------------------
If (! Empty ($ _ GET [fn]) {
// ----------------------------------------- Download --------------------------------------------------

$ Fn = $ _ GET ['FN '];
$ Basename = pathinfo ($ fn, PATHINFO_BASENAME );
Ob_end_clean ();
Header ('content-Encoding: none ');
Header ('content-Type: text/plain ');
Header ('content-Length: '. filesize ($ fn ));
Header ('content-Disposition: attachment; filename = "'. $ basename .'"');
Readfile ($ fn );
Exit ();

}

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.