Implementation of online compression and decompression using ASP

Source: Internet
Author: User
Tags rar

Use ASP implement on-line compression and decompression

Source: Pconline Programming Development Forum

[2005-07-15 10:35:43]

Author: CSBQ

Responsible Editor: Moningfeng

 

First, the question of the proposed

With the development of the Internet, the number of Web sites increased by an astonishing number. The role of the site in addition to the vast numbers of users to provide information services, but also should become netizens to upload and download the file site. In the process of uploading and downloading files, transmission time is the key, which requires a faster transmission speed. In the transmission speed fixed or up or down changes in the case, as far as possible to reduce the volume of transmission files, is a feasible way: Upload files, the first file to be uploaded with WinRAR compression, upload success in the site through the program to achieve the decompression; when downloading files, The file will be downloaded in the Web site through the program to achieve compression and then download. This paper discusses the solution to the problem.


Ii. method and Description

First of all to upload a winrar decompression program, is winrar own decompression program, only need its core program RAR.EXE this file can be, in the WinRAR installation directory can be found. Then you want to upload a program that executes RAR.EXE CMD. EXE This is the Windows operating system program, in the system disk Winnt/system32 folder can be found. After uploading the two files, you need to write some program code to achieve compression and decompression.

may wish to realize the compression function file name is zip.asp, realizes the decompression function the file name is unzip.asp.

The program code contains the command line syntax for the WinRAR application, which is briefly described below:

WinRAR < command >-< switch 1>-< switch n> < compressed file > < file ...> <@ list file ...> < decompression path/>

command to WinRAR the character combination that is running to represent the feature.

Switch switching operations specify type, compression strength, compressed file type, and so on.

Compressed file name to be processed by the cabinet.

File name to be processed by the file.

A list file list file is a plain text that contains the name of the file you want to work with. The filename should be started in the first volume. You can add a comment after the//character is used in the list file. For example, you can include two column strings to create a backup.lst:c:/work/doc/*.txt//Backup Text document C:/WORK/IMAGE/*.BMP//Backup picture C:/work/misc and then run: WinRAR a backup @ Backup.lst You can specify both the normal file name and the list file name on the command line.

The decompression path is used in combination with the command e and X. Indicates the location where the extracted file was added. If the folder does not exist, it is created automatically.


Alphabetical command list:

A add file to compressed file

C Add compressed file comment

D deletes files from compressed files

E extract compression from compressed file, ignore path

F Refresh files in compressed file

I find string in compressed file

K Lock compressed file

/p>

m moves files and folders to a compressed file

R repair Corrupted compressed files

RC Rebuild lost volumes

RN Rename compressed file

rr[n] Add data recovery record

Rv[n] Create a recovery volume

S[name] Convert compressed file to self-extracting file type

S-delete self-extracting module

T test compressed file

U from compressed file Update file

X extract compression from compressed file with full path name


In fact, the key to the program code is to use Server.CreateObject ("Wscript.Shell") to perform Cmd.exe,cmd.exe run RAR.EXE through the WinRAR command to perform uncompressed files and compressed files.


Iii. List of procedures

Zip. ASP Program list:

<%
' Main folder contains Cmd.exe Rar.exe For example: Files to compress (*.mdb)
' Compressed storage directory for Main/data.rar
On Error Resume Next
Unzip_path=server.mappath ("main") & "/"
Set WshShell = server. CreateObject ("Wscript.Shell")
issuccess = Wshshell.run ("WinRAR a" &unzip_path& "data
"&unzip_path&" *.mdb ", 1, False)
' WinRAR < command >-< switch 1>-< switch n> < compressed file > < file ...> <@ list file

Related Article

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.