OK, here's the thing. I have a script I've downloaded (I do intend to learn PHP eventually, but this needs to be done ASAP!) which uploads 4 files into a folder on my server. I've specified the MIME file types it needs to upload, and most of them (except image/png) work in Mozilla Firefox. I tried MSIE: image/jpeg doesn't work. Opera: png works, application/zip doesn't.
If someone can tell me what's wrong, I'll be the happiest person alive (well, almost!). You can call me stupid, I don't care.
Oh, the script is at http://driftersescape.net/jrm/upload.php if anyone wants to give it a whirl. And here's the whole thing:
<?php
/**
* Example file
*
* @author Marcos Thiago <fabismt@yahoo.com.br>
* @version 1.0
* @since 06/2004
* @package UPLOAD_FILES
*/
require_once("class_UPLOAD.php");
$upload =& new UPLOAD_FILES();
if($_FILES){
foreach($_FILES as $key => $file){
$upload->set("name",$file["name"]); // Uploaded file name.
$upload->set("type",$file["type"]); // Uploaded file type.
$upload->set("tmp_name",$file["tmp_name"]); // Uploaded tmp file name.
$upload->set("error",$file["error"]); // Uploaded file error.
$upload->set("size",$file["size"]); // Uploaded file size.
$upload->set("fld_name",$key); // Uploaded file field name.
$upload->set("max_file_size",5120000); // Max size allowed for uploaded file in bytes = 5MB.
$upload->set("supported_extensions",array("png" => "image/png","zip" => "application/zip",
"zip" => "application/x-zip-compressed",
"tif" => "image/tiff",
"tiff" => "image/tiff",
"xls" => "application/vnd.ms-excel", "ppt" => "application/vnd.ms-powerpoint",
"gif" => "image/gif",
"jpg" => "image/pjpeg",
"jpeg" => "image/pjpeg",
"jpg" => "image/jpeg",
"jpeg" => "image/jpeg",
"doc" => "application/msword",
"rtf" => "application/msword",
"rtf" => "application/rtf",
"pdf" => "application/pdf")); // Allowed extensions and types for uploaded file.
$upload->set("randon_name",FALSE); // Generate a unique name for uploaded file? bool(true/false).
$upload->set("replace",FALSE); // Replace existent files or not? bool(true/false).
$upload->set("file_perm",0444); // Permission for uploaded file. 0444 (Read only).
$upload->set("dst_dir",$_SERVER["DOCUMENT_ROOT"]."/jrm/upload"); // Destination directory for uploaded files.
$result = $upload->moveFileToDestination(); // $result = bool (true/false). Succeed or not.
}
}
?>
<html>
<head>
<title>SIMPLE SECURE UPLOAD</title>
<style>
.TABLE,TD,INPUT{
font-size:11px;
font-family:Verdana,Arial;
}
</style>
</head>
<body>
<form name="upload" id="upload" method="POST" enctype="multipart/form-data" action="upload.php">
<table cellpadding=2 cellspacing=2 border=0 align=center>
<tr><td> </td></tr>
<tr>
<td>
<table cellpadding=2 cellspacing=2 border=0 align=center>
<tr>
<td><b>File:</b></td>
<td>
<input type="file" name="file" id="file" size="20">
</td>
</tr>
</table>
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td>
<table cellpadding=2 cellspacing=2 border=0 align=center>
<tr>
<td><b>File 1:</b></td>
<td>
<input type="file" name="file_1" id="file_1" size="20">
</td>
</tr>
</table>
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td>
<table cellpadding=2 cellspacing=2 border=0 align=center>
<tr>
<td><b>File 2:</b></td>
<td>
<input type="file" name="file_2" id="file_2" size="20">
</td>
</tr>
</table>
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td>
<table cellpadding=2 cellspacing=2 border=0 align=center>
<tr>
<td><b>File 3:</b></td>
<td>
<input type="file" name="file_3" id="file_3" size="20">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=center><input type="submit" name="submit" id="submit" value="Upload"></td>
</tr>
<tr><td> </td></tr>
<tr>
<td>
<?php
if($upload->succeed_files_track || $upload->fail_files_track){
print "<pre>";
print "<b>Succeed Files Track Array:<br></b>";
print_r($upload->succeed_files_track);
print "<b>Fail Files Track Array:<br></b>";
print_r($upload->fail_files_track);
print "</pre>";
}
?>
</td>
</tr>
</table>
</form>
</body>
</html>