The concrete ideas about the database of image and text in ASP

Source: Internet
Author: User
Data | Database First, the type of your form is set to <form enctype= "Multipart/form-data"
action= "Uploadresult.asp" method=post>

Please choose a picture to upload:
<input name= "Picture" Type=file accept= "image/*" >
<input name= "Text1" Type=text >
</form>
Then the next page, separated by the way to separate the text, at this time can not use Request.Form, should be changed to
FormData = Request.BinaryRead (formsize)

Formsize = Request.TotalBytes
Bncrlf = ChrB (+) & ChrB (10)
Divider = LEFTB (FormData, INSTRB (FormData, Bncrlf)-1)
Datastart = INSTRB (FormData, Bncrlf & Bncrlf) + 4
Dataend = INSTRB (Datastart + 1, FormData, divider)-Datastart
Response.ContentType = "Image/gif"
Response.BinaryWrite MIDB (FormData, Datastart, Dataend)

Here, the image is the first.
Then convert the binary to text. (See Jinhua area)
Find the size.

Formsize = Request.TotalBytes
The total size is then subtracted from the size just obtained. Gets the text size. A string function is then used to derive its value.
Finally, the database exists separately.

Note that this method cannot complete a save as file. Because the file objects in VBScript cannot handle binary formats. (Image of the binary)
But VB can, so we can already use components to complete the above work.
I use my own components, so that I can finish saving as a database, and I can save bits of files. You can also limit size, file type (Gif,jpg,htm,exe), and so on, but the code of thought is still the code above. If you need, you can contact me.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.