[thelist] php file uploads

NanHarbisonSmith at aol.com NanHarbisonSmith at aol.com
Sun Mar 24 10:28:01 CST 2002


--
[ Picked text/plain from multipart/alternative ]
Hi Noah,
It does not look like anyone has answered your post about file uploads. I was
doing this same thing a few weeks ago, and was having the exact same problem
you are having. I read about how to do file uploads in about 5 PHP books, all
to no avail. Then I hit on the solution. The file name, which is a variable,
has to be concatenated to the rest of the location, like this:

if (copy($minutes_file, folder_location."/".$minutes_file_name))
  {
    print("File was succesfully copied.");

        //drop the temp file and print some of the variables for error
checking
        unlink ($minutes_file);
        print ("<br>local file: $minutes_file<br>\n");
        print ("Name: $minutes_file_name<br>\n");
        print ("Size: $minutes_file_size<br>\n");
        print ("Type: $minutes_file_type<br>\n");
        echo ($Array[year]);

} else {
    print("The file was not uploaded, please try again.");
    }

It was such a subtle use of concatenating, I had no idea I should have been
doing it.
HTH,
Nan


In a message dated 3/23/2002 12:57:28 AM Eastern Standard Time,
noah at tookish.net writes:


> I'm trying to get a php file upload to work, and not having any success.
>
> The script appears to run through properly - I don't get any errors, and
> afterwards I'm able to access $file, $file_name, $file_type, and $file_size
> for the file that I just (supposedly) uploaded. The file, however, is not
> on the server, either in the temporary directory or the permanent directory
> to which I'm subsequently trying to copy it.


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