TAILIEUCHUNG - PHP and MySQL Web Development - P74

PHP and MySQL Web Development - P74: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 16 Interacting with the File System and the Server I n Chapter 2 Storing and Retrieving Data we saw how to read data from and write data to files on the Web server. In this chapter we will cover other PHP functions that enable us to interact with the file system on the Web server. We will discuss Uploading files with PHP Using directory functions interacting with files on the server Executing programs on the server Using server environment variables in order to discuss the uses of these functions we will look at an example. Consider a situation in which you would like your client to be able to update some of a Web site s content for instance the current news about their company. Or maybe you want a friendlier interface than FTP for yourself. One approach to this is to let the client upload the content files as plain text. These files will then be available on the site through a template you have designed with PHP as we did in Chapter 6 Object-Oriented PHP Before we dive into the file system functions let s briefly look at how file upload works. Introduction to File Upload One very useful piece of PHP functionality is support for HTTP upload. instead of files coming from the server to the browser using HTTP they go in the opposite direction that is from the browser to the server. Usually you implement this with an HTML form one we ll use in our example is shown in Figure . 338 Chapter 16 Interacting with the File System and the Server Figure The HTML form we use for file upload has different fields and field types from those of a normal HTML form. As you can see the form has a box where the user can enter a filename or click the Browse button to browse files available to him might not have seen a file upload form ll look at how to implement this in a moment. After a filename has been entered the user can click Send File and the file will be uploaded to the server where a PHP script is waiting for it. HTML for File Upload

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.