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

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
14    27    1    02-04-2023
Đã 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.