[PLUG] PHP question

Aj Lavin aj at haightmail.org
Sun May 19 03:18:37 UTC 2002


On Sat, May 18, 2002 at 05:28:18PM -0700, Matt Alexander wrote:
> I'm trying to upload a file using PHP.
> Here's the main HTML file:
> 
> <html>
> <head><title></title></head>
> 
> <form method="post" action="upload.php">
> 
> <input type="file" name="file">
> <p><input type="submit" name="submit" value="Upload">
> 
> </form>
> 
> </body>
> </html>
> 
> 
> And here's the PHP file:
> 
> <?
> if ($file != "") {
> 	copy($file, "/tmp/$file_name") or die("Couldn't copy the file.");
> }

The uploaded temporary file name is given by:

$tmp_file= $HTTP_POST_FILES[ 'file'][ 'tmp_name'];

- Aj




More information about the PLUG mailing list