Hi Randall,

The code below should show you how to handle the file upload process  (in
example a text file). I've kept the source as simple as possible. Place both
files in the same directory and the uploaded file should also appear there.

 If you want to upload multiple files you will need to handle each file
separately in your php-file.


Best regards,
Per

The code:
=======

--- File: form.html ---


<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Upload">
<title>Upload</title>
</head>
<body bgcolor="#ffffff">
<FORM ENCTYPE="multipart/form-data" ACTION="uploadhandle.php" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="10000">
Send this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>
</body>

</html>


--- File: uploadhandle.php ---


<?
echo($userfile_name);
echo("<BR>");
echo($userfile);
if (copy($userfile, "upload.txt")) {
echo("<B>The file is now uploaded....</B>");
}
else {
echo("Error: Damm..!");
}
unlink($userfile);
?>

I have scanned the archives (probably looking in the wrong place), and have
tried the code in the documentation to no avail.

I need help understanding the issues of file uploading using php.  Here is
the setup:

PHP (ISAPI) installation.
PHP.INI is in C:\WINNT
the two DLLs are in C:\WINNT\SYSTEM32 (php4st.dll and msrcvt.dll) i think
those are the names
my entensions reside in C:\PHP\EXTENSIONS.
My PATH variable includes this location.

Here is the code:

---formtest.html---------------------------------
<html>
<body>

<form action="file-upload.php" method="post" enctype="multipart/form-data">
 Send these files:<br>
 <input name="userfile[]" type="file"><br>
 <input name="userfile[]" type="file"><br>
 <input type='submit' value='Send Files'>
</form>

</body>
</html>


--file-upload.php--------------------------------
<html>
<body>
Files uploaded...

<?php
move_uploaded_file($userfile[0], "\\temp");        // Just move the first
file.
?>

</body>
</html>

I get one of two things happening:

1)   I get two WARNINGS:  Cannot open/create ([1] the file I uploaded, and
[2] the target directory)

or

2) No errors, no warnings, but also no file was copied to the C:\TEMP
directory where I asked it to copy to.

It is also never consistent.  I either get the warnings with no result, or
NO warnings with no result.  In either case, I get no results. <frown>.

I am on Win2k and FAT32 disk format.  Therefore I don't have much
directory/file security to worry about.

Anyone help me please?  This is my first look at PHP and I can see the
power, but if it won't do what it is supposed to do, I don't see much use in
it.

Thanks in advance
RDB


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to