Connecting Tech Pros Worldwide Help | Site Map

PLEASE HELP

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:54 PM
matt.sus@gmail.com
Guest
 
Posts: n/a
Default PLEASE HELP

hi i have a website where people can register their details and upload
a pic.

so i have variables for firstName and lastName etc

not the following lines are in the php file that everything gets sent
to:

copy($HTTP_POST_FILES['uploadPhoto']['tmp_name'],
$HTTP_POST_FILES['uploadPhoto']['name']);
print "<h2>Thank you for registering.</h2><br>";
print "<h2>Your details have been saved on our system.</h2>";
print "<br>"


All the variables go nicely into the mysql database and the photo
uploads, however it just uploads with the name the person has it saved
on their computer as.

Is there a way to ammend the above to rename the photo they are
uploading as their firstName and lastName.

Please help as not only is it driving my crazy but i've also spent to
much in this t-mobile hotspot trying to google this problem.

Thanks


  #2  
Old July 17th, 2005, 12:54 PM
Alistair Baillie SS2002
Guest
 
Posts: n/a
Default Re: PLEASE HELP

> copy($HTTP_POST_FILES['uploadPhoto']['tmp_name'],[color=blue]
> $firstNAme . " " . $lastname . ".bmp" );[/color]

<matt.sus@gmail.com> wrote in message
news:1114721382.048432.88190@l41g2000cwc.googlegro ups.com...[color=blue]
> hi i have a website where people can register their details and upload
> a pic.
>
> so i have variables for firstName and lastName etc
>
> not the following lines are in the php file that everything gets sent
> to:
>
> copy($HTTP_POST_FILES['uploadPhoto']['tmp_name'],
> $HTTP_POST_FILES['uploadPhoto']['name']);
> print "<h2>Thank you for registering.</h2><br>";
> print "<h2>Your details have been saved on our system.</h2>";
> print "<br>"
>
>
> All the variables go nicely into the mysql database and the photo
> uploads, however it just uploads with the name the person has it saved
> on their computer as.
>
> Is there a way to ammend the above to rename the photo they are
> uploading as their firstName and lastName.
>
> Please help as not only is it driving my crazy but i've also spent to
> much in this t-mobile hotspot trying to google this problem.
>
> Thanks
>[/color]


  #3  
Old July 17th, 2005, 12:54 PM
Daniel Tryba
Guest
 
Posts: n/a
Default Re: PLEASE HELP

matt.sus@gmail.com wrote:[color=blue]
> copy($HTTP_POST_FILES['uploadPhoto']['tmp_name'],
> $HTTP_POST_FILES['uploadPhoto']['name']);
>
> Is there a way to ammend the above to rename the photo they are
> uploading as their firstName and lastName.
>
> Please help as not only is it driving my crazy but i've also spent to
> much in this t-mobile hotspot trying to google this problem.[/color]

Goto this URL: http://nl3.php.net/copy

Description
bool copy ( string source, string dest )

Makes a copy of the file source to dest. Returns TRUE on success or
FALSE on failure.

So just set the second argument to the variables you need.

  #4  
Old July 17th, 2005, 12:54 PM
Malcolm Dew-Jones
Guest
 
Posts: n/a
Default Re: PLEASE HELP

matt.sus@gmail.com wrote:
: hi i have a website where people can register their details and upload
: a pic.

: so i have variables for firstName and lastName etc

: not the following lines are in the php file that everything gets sent
: to:

: copy($HTTP_POST_FILES['uploadPhoto']['tmp_name'],
: $HTTP_POST_FILES['uploadPhoto']['name']);
: print "<h2>Thank you for registering.</h2><br>";
: print "<h2>Your details have been saved on our system.</h2>";
: print "<br>"


: All the variables go nicely into the mysql database and the photo
: uploads, however it just uploads with the name the person has it saved
: on their computer as.

: Is there a way to ammend the above to rename the photo they are
: uploading as their firstName and lastName.

If you already have the name in some variables, then just go ahead and
use them.

$name_for_save_as = "$firstName-$lastName.jpeg";

copy($HTTP_POST_FILES['uploadPhoto']['tmp_name'],$name_for_save_as);

HOWEVER, you should also do something to make sure the file name is a good
name. Read the php docs for functions to help do that, but basically
something like

$name_for_save_as = escape($firstName) . escape($lastName) . ".jpeg";

(but the "escape" function may not be the function you want to use for
this)


Many sites allocate a unique serial number for things like files. The
database entry for a person would then save the serial number so you know
which file to use for that person.

--

This space not for rent.
  #5  
Old July 17th, 2005, 12:54 PM
matt.sus@gmail.com
Guest
 
Posts: n/a
Default Re: PLEASE HELP

Thanks everyone. I really appreciate your help and I now have it
working.

I decided to take the shortest advice first, that was alistair's and it
worked great.

Thanks Alistair and thanks everyone else too.

Matt.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.