Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
ASP.NET 4 Unleased - p 22
Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 22
Hoàng Long
133
10
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Sử dụng điều khiển Rich Các trang web bao gồm một phương thức có tên CheckFileType (), trong đó ngăn người dùng tải lên một tập tin mà không có gif., jpeg, jpg, hoặc. png mở rộng. Phương pháp này hạn chế các loại tập tin có thể được tải lên dựa trên phần mở rộng tập tin. | 184 CHAPTER 4 Using the Rich Controls The page includes a method named CheckFileType which prevents users from uploading a file that does not have the .gif .jpeg .jpg or .png extension. The method restricts the type of file that can be uploaded based on the file extension. NOTE The HTML 4.01 specifications define an accept attribute that you can use to filter the files that can be uploaded. Unfortunately no browser supports the accept attribute so you must perform filtering on the server or use some JavaScript to check the filename extension on the client . To save a file to the file system the Windows account associated with the ASP.NET page must have sufficient permissions to save the file. For Windows 2003 and Windows 2008 servers an ASP.NET page executes in the security context of the NETWORK SERVICE account. In the case of every other operating system an ASP.NET page executes in the security context of the ASPNET account. To enable ASP.NET Framework to save an uploaded file to a particular folder you need to right-click the folder within Windows Explorer select the Security tab and provide either the NETWORK SERVICE or ASPNET account Write permissions for the folder see Figure 4.2 . FIGURE 4.2 Adding Write permissions for the ASPNET account. From the Library of Wow eBook Accepting File Uploads 185 Saving Files to a Database You also can use the FileUpload control to save files to a database table. Saving and retrieving files from a database can place more stress on your server. However it does have certain advantages. First you can avoid file system permissions issues. Second saving files to a database enables you to more easily back up your information. The page in Listing 4.2 enables you to save Microsoft Word documents to a database table see Figure 4.3 . LISTING 4.2 FileUploadDatabase.aspx @ Page Language C @ Import Namespace System.IO DOCTYPE html PUBLIC - W3C DTD XHTML 1.0 Transitional EN http www.w3.org TR xhtml1 DTD xhtml1-transitional.dtd script runat
TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã 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.