(For Unix/Linux/MS Windows)
Upload files with your browser
upload.pl is simple perl
CGI script to upload file using
netscape 2.0+ or
Internet Explorer 4.0+.
The program uses the excellent
perl module (part of standard perl now).
To upload a file, the user must validate herself. The script
uses a text file as a user database. The text file contains
the vertical bar separated userid, Unix crypted password (
can be used in Windows as well) and user's
How to use
If you use this script,
Please let me know as well. I tested
this script on Linux and MS NT 4.0 and MS
- rename it to upload.pl,
mv upload.txt upload.pl (in Unix)
- Check the first line of the script upload.pl, and make sure it points to the correct path of
perl. For MS Windows, it might look like:
chmod 755 upload.pl
(To make the script executable in Unix)
- Copy upload.pl to your cgi-bin directory or where ever you keep CGI
programs. Read about common problems related to CGI scripts in
- Look at the script upload.pl. If needed, edit the variables: $g_upload_db,
$g_overwrite. The variable $g_upload_db specified the
path of the
authentication text file. The variable $g_overwrite specifies if the
existing file will be over-written or not. The default is to overwrite.
- if you want to restrict upload to files with certain extentions, change
the value of
$g_restrict_by_ext to 1 and ALSO modify the @g_allowed_ext if you
want to add other allowable extensions.
- If you want to restrict upload file size (in bytes) uncomment the line
$CGI::POST_MAX=50000; at the top of the script and change the number
- Create the text file for authentication, the name and path is
specified by the variable $g_upload_db. The format of the text
file is as follows:
In Windows, the file might look like:
The directory for the users must be created by the administrator. The web
server must be able to write to these directories.
You can use the
to create the crypted password
or you just can cut and paste from /etc/passwd file (not recommended).
Or install the CGI script
- Access the script: http://web_server/cgi-bin/upload.pl
- That's all folks!
Freeware. Do whatever you like with it. It would be nice but not required
if you give me the credit for it.
THIS PROGRAM IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
AUTHOR Muhammad A. Muquit BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
- Write more desriptive error messages.
- Handle CR at the end of db file. It can happen if someone is ftp's to a Windows machine.
- Upload can be restricted by size or file extention.
- The format of the upload.db file is changed, now the userid, Unix crypted
password and upload path are separated by a vertical bar instead of colon.
- James Bee, JamesBee@home.com, reported that from Windows filename
such as c:\foo\fille.x remains as c:\foo\file.x, Fixed, Jul-22-1999.
URL of this page: