Re: upload a file from a pc
| From: | B U Y - H P | Date: | Tue, 23 Apr 2002 21:46:18 +0000 |
| Subject: | Re: upload a file from a pc | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94273@lists.php.net to get a copy of this message | ||
Try this.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Upload</title>
</head>
<body>
<form ENCTYPE="multipart/form-data" method="POST"
action="upload.php">
File:<INPUT TYPE="FILE" NAME="userfile"
SIZE="35">
<input type="hidden" name="MAX_FILE_SIZE"
value="1000000">
<input type="submit" value="Upload"
name="B1">
Please click only <b>once</b> and wait for confirmation
</form>
<?php
//echo date("l, F dS",$modified[9]);
if($userfile){
//print "$userfile = userfile\n";
//print "$userfile_name = userfile_name\n";
print "$userfile_type = userfile_type\n";
//print "$userfile_size = userfile_size\n";
//print "$tmp_name = tmp_name\n";
move_uploaded_file($userfile,$DOCUMENT_ROOT."/upload/".$userfile_name);
}
?>
</body>
</html>
/carsten
"Dave" <dleather@fineline.ca> wrote in message
news:20020423190331.1312.qmail@pb1.pair.com...
> Whats the easiest way to create a script to upload a file from my home PC
to
> my web server using PHP?
>
> Example - I want to copy a graphic called "TITLE.GIF" from my pc to my web
> page by using PHP.
>
> Is there a command to do this easily?
>
> Please help.
> Dave
>
>
>
>