Re: move_uploaded_file() query
| From: | Jason Wong | Date: | Fri, 25 Jan 2002 15:14:52 +0000 |
| Subject: | Re: move_uploaded_file() query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82103@lists.php.net to get a copy of this message | ||
On Friday 25 January 2002 17:35, Will Hives wrote:
> Sorry for my past ignorance using this news site forum I can only out this
> down to my lack of knowledge.
>
> I have been work on me first script for some time now and have been making
> good progress up until now. I have a script that adds a author to the
> database, ID, Name, Email, Picture Name.
>
> When a author is added it uploads their details plus it uploads and renames
> the image...that is working fine. It all falls down when I try and call the
> new file name to show the picture. It is uploading the original file name
> to the database and not the renamed version.
>
> I would be very grateful for any pointers on how this small problem can be
> solved. I hope this makes more sense than previous threads I have
> submitted.
>
> Cheers
> Will
>
> Here is the script as it stands:
>
> $sql = "INSERT INTO $table_name (id, name, email, picture_name)
> VALUES ('$id', '$name', '$email', '$picture_name')
> ";
>
> $result = @mysql_query($sql, $connection) or die ("couldn't execute
> query");
>
> if ($picture != "") {
>
> $path = "/home/main/main/php/";
> $datee = date("sdFy");
> move_uploaded_file($picture,$path . $datee . $picture_name);
>
> }
Is this the *full* script? I don't see where you are setting $picture_name?
Also what you are inserting into the database is not the same as what you are
renaming your file to (you're adding a date string to the filename). Do you
have a procedure to resolve the correct filename when retrieving the data
from the db?
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
All of life is a blur of Republicans and meat!
*/