ACCEPT mode
kan godt op loade gif op til sevver men ikke jpeg, hvad skal jeg gøre . hvor store jpeg fil kan jeg op load.. kan man lave en html side hvor folk kan se de jpeg de op loadder#--------------------------------#
# REQUIREMENTS
#--------------------------------#
To run and have fun with fileupload.class you will need access to a
Unix/Linux/*nix web server running Apache with the PHP module, a web
browser that supports uploading (like Netscape), and the 2 other files
that came with this.
#--------------------------------#
# QUICK SETUP
#--------------------------------#
1) Make a new directory within your with you web directory called "fileupload"
2) Upload the files "fileupload.class" and "upload.php" (depending on
how you've got Apache configured, you may need to rename this "upload.php3")
3) Make another directory within the "fileupload" directory called "uploads"
and give it enough upload permissions for you web server to upload to it.
(usually, this means making it world writable)
- cd /your/web/dir/fileupload
- mkdir uploads
- chmod 777 uploads
4) Fire up Netscape of IE and hit test it out:
http://www.yourdomain.com/fileupload
#--------------------------------#
# DETAILED INSTRUCTIONS
#--------------------------------#
You should have downloaded 3 files:
- README.txt (this file)
- fileupload.class
- upload.php
fileupload.class:
This is the file that does all the work. You shouldn't have to
change anything in this file, unless you're getting lots of errors.
Lines 114 and 122 can be changed from $aok = copy(...); to
$aok = rename(...);
upload.php
Here's where all the variables reside (see below for an explaination of
each). NOTE you may need to rename this file upload.php3, depending
on how you've got Apache configured.
VARIABLES in "upload.php":
// The path to the directory where you want the
// uploaded files to be saved. This MUST end with a
// trailing slash unless you use $PATH = ""; to
// upload to the current directory. Whatever directory
// you choose, please chmod 777 that directory.
$PATH = "uploads/";
// The name of the file field in your form.
$FILENAME = "userfile";
// ACCEPT mode - if you only want to accept
// a certain type of file.
// possible file types that PHP recognizes includes:
//
// OPTIONS INCLUDE:
// text/plain
// image/gif
// image/jpeg
// image/png
$ACCEPT = "image/gif";
// If no extension is supplied, and the browser or PHP
// can not figure out what type of file it is, you can
// add a default extension - like ".jpg" or ".txt"
$EXTENSION = "";
// SAVE_MODE: if your are attempting to upload
// a file with the same name as another file in the
// $PATH directory
//
// OPTIONS:
// 1 = overwrite mode
// 2 = create new with incremental extention
// 3= do nothing if exists, highest protection
$SAVE_MODE = 1;
#--------------------------------#
