On Wednesday 11 December 2002 18:55, Steve Jackson wrote:
> > On Wednesday 11 December 2002 17:30, Steve Jackson wrote:
> > > I'm trying to rename an uploaded file with the value of a select I
> > > have in the uploaded form. Can someone point me in the right
> > > direction. The PHP.net rename manual isn't helping a lot? My code:
> >
> > What is the problem?
>
> I can't figure out how to upload the file with the name I need. The
> rename function in the manual says
> Its:
> rename("string1","string2")
> Ie.
> <?php
> rename("/tmp/tmp_file.txt", "/home/user/login/docs/my_file.txt");
> ?>
>
> I want to rename the file copied to the server to the name of the select
> value I sent in my previous post (held in the variable $category) so
> basically How do I do that? Where do I do it in the upload script also?
> You mention I should be able to do it in a single step, that would be
> ideal but again how do I do it? Do I need to put the uploaded file in a
> variable so I can rename the copied image?
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
copy($HTTP_POST_FILES['userfile']['tmp_name'],"http://www.violasystems.c
om/images/$category");
That should do it in a single step.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Many Myths are based on truth
-- Spock, "The Way to Eden", stardate 5832.3
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php