View Single Post

  #4 (permalink)  
Old 12-14-2004
Janwillem Borleffs
 
Posts: n/a
Default Re: quick simple upload

Québec wrote:
> Because it is for an input from the web, from a user who would have to
> painfully have to learn how to use and install ftp.
>


Here's a quicky:

<?php

// Name of the dir with 777 permission, to move the
// uploaded file to, without a trailing slash
$dir = "temp";

if (isset($_FILES['file']) && !$_FILES['file']['error']) {
list($name,,$tmp_name) = array_values($_FILES['file']);
move_uploaded_file($tmp_name, "$dir/$name");
}

?>
<html>
<head>
<title> New Document </title>
</head>

<body>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" />
</form>
</body>
</html>


JW



Reply With Quote