ASP (Active Server Pages) is a very early Web application solution from Microsoft, and a simpler programming environment that most developers of web sites are familiar with. With ASP, we can create powerful dynamic Web applications. Although the ASP is very powerful, but some of the functionality with pure ASP code can not be done, in order to ensure the development of more powerful Web applications, we can invoke the use of COM components.
In daily work, such as the development of a "commodity online marketing System" bar, in order to enable customers to understand the appearance of goods, that is, customers look at the text of the product at the same time in the text next to the image of the product to explain, so that customers can have a systematic understanding of the product, the promotion of goods has a great help. So when we develop the system, of course we need to add a picture processing module, how to upload pictures to the server (the picture can be placed in a folder on the Web server can also be placed in a SQL Server server) and how to let the uploaded pictures on the browser side display, this is a developer to consider the problem.
Upload pictures to the server there are several ways, you can use the file upload components can also use the pure ASP code to achieve. In the CSDN Web version of ASP often asked such a question "How to use ASP to upload the picture to the database", in order to facilitate the csdn need to understand this knowledge, this article will explain the use of ASP upload pictures of the practice and give the code, readers.
First look at the various objects and their syntax that are used in your program:
1) Request.BinaryRead () method
Use the Request.BinaryRead () method to get the submitted file data
Syntax
Varrevalue= Request.BinaryRead (number)
The variable Varrevalue return value holds the binary data read from the client;
Parameter number indicates the size of the binary data to be read from the client.
2) Response.BinaryWrite () method
Use the Response.BinaryWrite () method to get picture data from the database and display it in the client's browser.
Syntax
Response.BinaryWrite data
Parameter data is a binary packet to be written into the client browser.
3) AppendChunk method
The purpose of the AppendChunk method is to append binary data to a field or Parameter object.
Syntax
Object. AppendChunk data
Parameter data is the packet to append to the field or Parameter object.
4) GetChunk Method
The GetChunk method returns the contents of the binary data.
Syntax
Object. GetChunk (size)
The parameter size indicates the length of the binary data to be returned, which can be a long integer expression.