[thelist] PHP-fileupload

NanHarbisonSmith at aol.com NanHarbisonSmith at aol.com
Sat May 18 13:46:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
Melvin,
I beat my head against the wall on a file upload problem, and I finally
figured out the solution. I think your problem is the same one I had, which
is that you have to concatenate the slash in front of the name of the file,
like this:
if(!copy($userfile, "/".$userfile_name")){
where you have:
if(!copy($userfile,"./$userfile_name")){

The books I looked this up in seemed to assume that since you know about
concatenation, you would automatically know to do this here.
HTH,
Nan

In a message dated 5/18/2002 2:26:23 PM Eastern Daylight Time,
evolt at melvin-isken.de writes:


> Hi out there!
> What´s wrong with this:
> This is my html-file (upload.htm)
> <form ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD="POST">
> <input type="file" name="userfile"/>
> <input type="submit" value="Upload" name="bu1" />
> </form>
> This is the php-file (upload.php):
> <?php
> echo "button pressed
> ";       <-works
> echo $userfile."
> ";               <-works
> echo $userfile_name."
> ";     <-works
> echo $userfile_size."
> ";        <-works
> echo $userfile_type."
> ";       <-works
> if(!copy($userfile,"./$userfile_name")){               <-doesn´t work!!!
>             echo "
> error";
> }
> ?>


Nan Harbison Smith
481 Elm Street
Concord, MA 01742
978-369-1224
978-369-1681

Give a man a fish and you feed him for a day; teach him
to use the Internet and he won't bother you for weeks.





More information about the thelist mailing list