[thelist] php file uploads

Daniel Farkas bup at neobee.net
Mon Mar 25 05:56:01 CST 2002


Hi, guys.

I don't know if you are satisfied with your solution.
I think I have better one.
Just replace copy with move_uploaded_file, without any concatenation.

Daniel Farkas
bup at neobee.net

snippet 1:
> > 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.

snippet 2:
> 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.");
>     }




More information about the thelist mailing list