<html>
<head>
<title>Week #13 Example ~ Lestat</title>
<link rel="stylesheet" type="text/css" href="/css/scriptskewl.css">
</head>
<body>
<form method="POST" action="<? $PHP_SELF ?>" ENCTYPE="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="<script language="php">echo($max_fsize);</script>">
Choose File: <input name="file1" type="file" size="50"> <input type="submit" value="Upload File">
</form>
<?
// is there a file to upload?
if($file1 != "none") {
// copy uploaded file to a new location
if (copy($file1, "uploaded_files/$file1_name")) {
// set permissions on this file
chmod("uploaded_files/$file1_name", 0644);
print("<br>successful upload of $file1_name<br>
SIZE: $file1_size<br>
TYPE: $file1_type<br>");
// delete uploaded temp file (*see note below)
unlink($file1);
} else {
print('Error uploading file. Are directory permissions amenable?');
}
} else {
print('No file was submitted. Go back and choose a file, please');
}
?>
<?
/*
$max_fsize()
copy()
unlink()
*/
?>
<!------------- END ------------->
<br><a href='../index.html'>Index</a><br>
<iframe src='examplesrc.php' width='100%' height='300'></iframe>
<br>
<a href='../index.html'>Index</a>
</body>
</html>