How to automatically compress uploaded files ?
I will explain how to compress uploaded files. There are many variants of this
sample, but hopefully once you have understood how it works, it is very easy
to modify it. This example uses WinRAR, an excellent compressor for Windows
which has great command line options.
I assume that you have already created an account and set a folder where the
user will be able to put his files.
- First of all open the User
Dialog, select the account, then go to the events tab.
- Click on the "a file as been uploaded" event.
- Click on the execute check box.
- Add the path where winrar.exe resides. In the example, it is c:\Program
Files\WinRAR\Winrar.exe
You can use the ... button that brings up a browser window.
- Add the correct arguments. Here it is: a -s -ep1 "%FILEDIR\%USERNAME"
"%FILEPATH"
Notice the use of inverted commas in order to handle correctly paths with
spaces in them.
This command line creates a RAR file named with the name of the user. Each
uploaded file will be added to the archive. Notice that the original file
is not destroyed. Please check your compressor documentation for the different
command line options. With winRAR especially, you can do all kind of processing.
Go to main page
Copyright © 2000, 2001 ACLogic, Alexandre Cesari