[thelist] php file uploads

Hans Zaunere zaunere at yahoo.com
Mon Mar 25 08:31:01 CST 2002


This is really covered at
http://us2.php.net/manual/en/features.file-upload.php.

I don't like to just say RTFM, but this pretty much
covers it.

There may be some issues if your are using safe mode
and/or open_basedir.  But you should always use
move_uploaded_file() and it's related functions when
doing file uploads.

Hans Z.
New York PHP
http://nyphp.org



--- Daniel Farkas <bup at neobee.net> wrote:
>
> 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.");
> >     }
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/



More information about the thelist mailing list