New Generation University Faculty of Computer Science Chapter Five: File Uploaded and Ad Rotate Lecturer: Mukhtar Mohamed Ali “Hakaale”

Slides:



Advertisements
Similar presentations
PHP File Upload ISYS 475.
Advertisements

The eXtensible Markup Language (XML) An Applied Tutorial Kevin Thomas.
Java Script Session1 INTRODUCTION.
How To Create A Web Page By: Mikeon Briddy & Darrius Jacobs April 10,2006 Mr. Barnett.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
HTML Hypertext Markup Language –First proposed by CERN in 1989 –It is non-linear so it allows you to jump from place to place –Markup refers to the structure.
JavaScript Forms Form Validation Cookies CGI Programs.
Web Page Development Identify elements of a Web Page Start Notepad
Introduction to HTML 2006 INT197B. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
FIRST COURSE Creating Web Pages with Microsoft Office 2007.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
Creating Web Page Forms
Uploading Files. Why? By giving a user the option to upload a file you are creating an interactive page You can enable users have a greater web experience.
 Definition of HTML Definition of HTML  Tags in HTML Tags in HTML  Creation of HTML document Creation of HTML document  Structure of HTML Structure.
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
Creating a Simple Page: HTML Overview
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Creating a Basic Web Page
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Chapter 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
HTML, XHTML, and CSS Chapter 12 Creating and Using XML Documents.
ASP.NET 2.0 Chapter 5 Advanced Web Controls. ASP.NET 2.0, Third Edition2 Objectives.
XHTML Introductory1 Linking and Publishing Basic Web Pages Chapter 3.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 4-1 of…
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
Learning Web Design: Chapter 4. HTML  Hypertext Markup Language (HTML)  Uses tags to tell the browser the start and end of a certain kind of formatting.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
Introduction to HTML Tutorial 1 eXtensible Markup Language (XML)
HTML Concepts and Techniques Fourth Edition Project 12 Creating and Using XML Documents.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
1 HTML Forms
ITCS373: Internet Technology Lecture 5: More HTML.
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
JavaScript - A Web Script Language Fred Durao
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
1 HTML Forms
Introducing the World Wide Web Internet- a structure made up of millions of interconnected computers whose users communicate with each other and share.
The Web Wizard’s Guide to HTML Chapter One World Wide Web Basics.
Tutorial 3 Adding and Formatting Text with CSS Styles.
HTML Hyper Text Markup Language 1BFCET BATHINDA. Definitions Web server: a system on the internet containing one or more web site Web site: a collection.
HTML Concepts and Techniques Fifth Edition Chapter 4 Creating Tables in a Web Site.
HTML HyperText Markup Language. Text Files An array of bytes stored on disk Each element of the array is a text character A text editor is a user program.
1 HTML forms (cont.)
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Invitation to Computer Science 6 th Edition Chapter 10 The Tower of Babel.
HTML HYPER TEXT MARKUP LANGUAGE. INTRODUCTION Normal text” surrounded by bracketed tags that tell browsers how to display web pages Pages end with “.htm”
XP Review 1 New Perspectives on JavaScript, Comprehensive1 Introducing HTML and XHTML Creating Web Pages with HTML.
Writing Your Own Web Page: Using HTML and FrontPage Chapter 10.
1 2/16/05CS120 The Information Era Chapter 4 Basic Web Page Construction TOPICS: Intro to HTML and Basic Web Page Design.
1 HTML forms (cont.)
HTML-I Basic HTML Elements. HTML (Hyper Text Markup Language) HTML is a document layout and hyperlink- specification language. i.e. a language used to.
XML Extensible Markup Language
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
Section 10.1 Define scripting
Using the HTML and CSS Validation Services
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
Using Templates and Library Items
Presentation transcript:

New Generation University Faculty of Computer Science Chapter Five: File Uploaded and Ad Rotate Lecturer: Mukhtar Mohamed Ali “Hakaale”

Topic Overview  With ASP.NET, accepting file uploads from users has become extremely easy. With the FileUpload control, it can be done with a small amount of code lines, as you will see in the following example. However, please notice that there are security concerns to to consider when accepting files from users! Here is the markup required:

What is File Uploaded  ASP.Net has two controls that allow the users to upload files to the web server. Once the server receives the posted file data, the application can save it, check it or ignore it. The following controls allow the file uploading:  HtmlInputFile - an HTML server control  FileUpload - and ASP.Net web control

File Upload Cont ….  Both the controls allow file uploading, but the FileUpload control automatically sets the encoding of the form, whereas the HtmlInputFile does not do so.  In this tutorial, we will use the FileUpload control. The FileUpload control allows the user to browse for and select the file to be uploaded, providing a Browse button and a text box for entering the filename.  Once, the user has entered the filename in the text box, by typing the name or browsing, the SaveAs method of the FileUpload control can be called to save the file to the disk.

Basic Syntax  The basic syntax for using the FileUpload is:

Properties of File Uploaded  The FileUpload class is derived from the WebControl class, and inherits all its members. A part from those, the FileUpload class has the following read- only properties: PropertiesDescription FileBytes Returns an array of the bytes in a file to be uploaded.. FileContent Returns the stream object pointing to the file to be uploaded. FileName Returns the name of the file to be uploaded. HasFile Specifies whether the control has a file to upload. PostedFile Returns a reference to the uploaded file.

Properties of File Uploaded Cont …  The posted file is encapsulated in an object of type HttpPostedFile, which could be accessed through the PostedFile property of the FileUpload class.  The HttpPostedFile class has the following important properties, which are much used: PropertiesDescription ContentLength Returns the size of the uploaded file in bytes. ContentType Returns the MIME type of the uploaded file FileName Returns the full filename. InputStream Returns a stream object pointing to the uploaded file.

Example of File Uploaded  The following example demonstrates the FileUpload control and its properties. The form has a FileUpload control along with a save button and a label control for displaying the file name, file type and file length.  In the design view, the form looks like:

The content file:

The code behind the save button:

Note the following:  The StringBuilder class is derived from System.IO namespace, so it should be included.  The try and catch blocks are used for catching errors, and display the error message.

What is Ad Rotate  The AdRotator control randomly selects banner graphics from a list, which is specified in an external XML schedule file. This external XML schedule file is called the advertisement file.  The AdRotator control allows you to specify the advertisement file and the type of window that the link should follow in AdvertisementFile and Target property respectively.

Syntax of AdRotator  The basic syntax of adding an AdRotator is as follows:  Before going into details of the AdRotator control and its properties, let us look into the construction of the advertisement file.

The Advertisement File  The advertisement file is an XML file, which contains the information about the advertisements to be displayed.  Extensible Markup Language (XML) is a W3C standard for text document markup. It is a text- based markup language that enables you to store data in a structured format by using meaningful tags. The term 'extensible' implies that you can extend you ability to describe a document by defining meaningful tags for your application.  XML is not a language in itself, like HTML but, a set of rules for creating new markup languages. It is a meta-markup language. It allows developers to create custom tag sets for special uses. It structures, stores and transport information.

Example of XML AdRotate File  Following is an example of XML file:

Elements of XML File  Like all XML files, the advertisement file needs to be a structured text file with well-defined tags delineating the data. There are the following standard XML elements that are commonly used in the advertisement file:

Cont …  Apart from these tags, customs tags with custom attributes could also be included. The following code illustrates an advertisement file ads.xml:

Properties and Events of the AdRotate Class  The AdRotator class is derived from the WebControl class and inherits its properties. Apart from those the AdRotator class has the following properties:

Cont …  Following are the important events of the AdRotator Class:

Working with the AdRotator Control  Create a new web page and place an AdRotator control on it  The ads.xml file and the image files should be located in the root directory of the web site.  Try to run the above application an dobserve that each time the page is reloaded, the ad is changed

The End Last but not least