in article [EMAIL PROTECTED], Jason Wong at [EMAIL PROTECTED] wrote on 25/1/02 3:14 pm:
> 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? > No I don't have a procedure to retrieve the new file name that's what I am looking to do. I don't know how to write that new name into the database. Picture name is the file name that is being inserted into the database (THIS IS THE OLD FILE NAME)from the html form. The browse field is named 'picture' (see all code below) the name that the database is capturing is not the new name of the fill ie. not the one that has the date inserted at start. Thank you for your help Cheers Will html form/ <html> <head> <title>my contact management system: add a contact</title> </head> <body> <form method="post" action="script below" ENCTYPE="multipart/form-data"> <table cellspace=3 cellpadding=5> <tr> <th>Name & email information</th> <th> </th> </tr> <tr> <td valign=top> <p><stong><font size="-2" face="Verdana, Arial, Helvetica, sans-serif">name:</font><br> <input type="text" name="name" size=35 maxlength=75> </p> <p><stong><font size="-2" face="Verdana, Arial, Helvetica, sans-serif">email:</font><br> <input type="text" name="email" size=35 maxlength=75> <br> </p> <font size="-2" face="Verdana, Arial, Helvetica, sans-serif">File to Upload:</font><br> <input type="file" name="picture" size="30"> <p><stong></p> </td> <td valign=top> </td> </tr> <tr> <td align=center colspan=2> <div align="left"><br> </div> <p align="left"> <input type="submit" name="submit" value="add to contact system"> </p> <div align="left"></div> </td> </tr> </table> </form> </body> </html> php script/ <? $db_name = "main"; $table_name = "main"; $connection = @mysql_connect("www.main.net", "main", "main 2") or die ("couldn't connect."); $db = @mysql_select_db($db_name, $connection) or die ("couldn't select database."); $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"); copy($picture,$path . $datee . $picture_name); } ?> <html> <head> <title>my contact management system: add a contact</title> </head> <body> <table cellspace=3 cellpadding=5> <tr> <th>Name & email information</th> <th> </th> </tr> <tr> <td valign=top> <p><stong><font size="-2" face="Verdana, Arial, Helvetica, sans-serif">name:</font><br> <? echo "$table_name"; ?> <? echo "$name"; ?> </p> <p><stong><font size="-2" face="Verdana, Arial, Helvetica, sans-serif">email:</font><br><? echo "$email"; ?> <br> </p> <font size="-2" face="Verdana, Arial, Helvetica, sans-serif">File to Upload:</font><br> <img src=<? echo "http://www.main.net/main/$picture_name"; ?>> <p><stong></p> </td> <td valign=top> </td> </tr> <tr> <td align=center colspan=2> <div align="left"><br> </div> <p align="left"> <input type="submit" name="submit" value="add to contact system"> </p> <div align="left"></div> </td> </tr> </table> </body> </html> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]