About Pictures in the Websites and Management!

xiaoxiao2021-03-06  87

I have experienced experience in developing websites in my business, I have always feel very headache. I used to upload images in the earliest, but every time I upload, the client wants to download the plugin. To the later no component upload, although there is no client, the management is a bit zero chaotic on the website: 1. Put the picture directory to be able to handle, delete permissions. 2, can not be renamed, so to solve the method of the picture name. 3. For example, the picture is uploaded for the issuer news. When you want to delete the news, you should write a code to delete the image. Because the relationship between permissions is likely to delete or delete the speed of the page. 4, it will also be easily subject to other websites, stealing chains. So, I think it is good to set the picture uploaded by each module and centralized management is good! Specific operation: Create a new table, used to store the second data of the picture, an automatic plus one ID number. When the image is uploaded, the binary data of the picture is stored in the library, then get the ID number of the image, and the record is recorded as soon as the ID number is recorded! The warehouse program (as an example): Demo1.asp <% 'Picbriny is the picture binary data. As for how to get pictures binary data from the form, you can find a component-free uploading principle 'table name PIC' column name image to store the two-binary data of the picture 'column ID automatically add a RS.Open "PIC", conn, 1 3 rs.addnew () rs.fields ("image"). Appendchunk picbriny rs.Update 'You can get the ID number of the picture: rs.fields ("ID") rs.close%> Image displayed page: Demo2.html Image picture Out Breaker program (Take ASP as an example): demo3.asp <% id = request ("id") rs.open "Select Image from Pic Where Id =" & ID, CONN, 1, 1 Response.binaryWrite RS ("Image"). GetChunk (7500000) Rec.close%> In summary, it can solve the above problem! 2, the picture has its own ID number in the table, there will be no name! 3. When the record of the reference picture is to be deleted, just remove a record in the library! 4, if you want to prevent the chain only in the outbound program: demo3.asp, you can use the verification! 5. It is convenient for other various types of pictures! Currently think of so much, of course, there are some problems: the system database The requirements are improved, and the speed will be affected when uploading a few M picture, of course, if the system performance is good, it is highly recommended to use this solution. The code puts the picture directly in the directory before it is complicated! So if there is not a lot of places in the website, or don't use this solution!

转载请注明原文地址:https://www.9cbs.com/read-105932.html

New Post(0)