Đang chuẩn bị liên kết để tải về tài liệu:
Beginning asp net 2.0 with c phần 5

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

saveFile = Path.Combine (savePath, FileUpload1.FileName) FileUpload1.SaveAs (saveFile); / / Hiển thị trạng thái của sự thành công StatusLabel.Text = "file của bạn đã được tải lên thành công.";} catch (Exception exUpload) {/ / hiển thị trạng thái lỗi StatusLabel.Text exUpload.Message;}} else {/ / có thể tập tin không phải là lựa chọn / trạng thái / Hiển thị của sự thất bại StatusLabel.Text = "Bạn không chỉ định một tập tin để tải lên.";} . | Chapter 8 saveFile Path.Combine savePath FileUploadl.FileName FileUploadl.SaveAs saveFile Displays status of success StatusLabel.Text Your file was uploaded successfully. catch Exception exUpload display status of error StatusLabel.Text exUpload.Message else probably file was not selected Display status of failure StatusLabel.Text You did not specify a file to upload. In the following Try It Out you give users a way to add pictures to the gallery. Try It Out Uploading Files Basic 1. Using VWD create a new page named GalleryUpload.aspx using the Web Form template. As you have with most pages up to this point use the site.master as the Master page use Visual C and enable the option to place the code on a separate page. 2. In Design View add a FileUpload control from the Toolbox and a Label control that will have an ID of FileUploadReport with an empty text property. Also add a button control with the text property set to Upload . 3. Double-click the button to go to its code. Add the following shaded code to the Sub using System using System.IO using . public partial class GalleryUpload System.Web.UI.Page protected void Buttonl_Click object sender EventArgs e string ImagesFolder Matchimages string savePath string saveFile if FileUploadl.HasFile try perform the upload savePath Path.Combine Request.PhysicalApplicationPath ImagesFolder saveFile Path.Combine savePath FileUploadl.FileName FileUploadl.SaveAs saveFile Displays status of success FileUploadReport.Text Your file was uploaded successfully. catch Exception exUpload 276 Writing Data display status of error FileUploadReport.Text exUpload.Message else probably file was not selected Display status of failure FileUploadReport.Text You did not specify a file to upload. 4. Save the page and view it in your browser see Figure 8-11 . You probably won t have pictures of the hapless Wrox United tumblers but you can try uploading any jpeg or gif you have on your hard drive. Figure 8-11 How It Works The FileUpload control .

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.