RE: Brand New to PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Look at the section in the manual on how to upload files via HTTP (Under the
"Features" chapter from memory) for working with the images. a couple other
things to think about;

1. some sort of validation on the images to make sure they are images
   (extension/mim-type?)
2. confirm that you can successfully upload/copy the files *before*
inserting
   their names into the DB, otherwise you might end up with false pointers.
3. your output is hard-coded to your local address - not a great idea. set
it
   all up as a local webserver and emulate the environment where it will be
   deployed as closely as possible - it will make your life much easier in
the
   long run.

HTH

Beau


// -----Original Message-----
// From: John [mailto:johnx@inetgenesis.com]
// Sent: Monday, 9 December 2002 1:10 PM
// To: php-db@lists.php.net
// Subject:  Brand New to PHP
// 
// 
// Hi and thanks in advance,
// 
// I am quite new to php and appreciate the help and patience.  
// I am trying to have a form that allows uploading of user 
// info and accompanying images into MySQL DB.  Text enters 
// fine into the DB but the images will not.  I hope I provided 
// enough info below (didnt want to post much more code for all 
// to sift thru if not necessary)
// 
// 
// 
// <?php
// if ($submit) {
//   // process form
//   $db=mysql_connect("66.220.69.20","*******","******");
//   mysql_select_db("sammies models",$db);
//   $sql="INSERT INTO models (first, last, age, email, 
// location, eye, hair, experience, aspirations, mtype, 
// picname1, picname2, picname3, picname4, picname5, picname6, 
// picname7, picname8) 
//   VALUES 
// ('$first','$last','$age','$email','$location','$eye','$hair',
'$experience','$aspirations','$mtype','$picname1','$picname2','$picname3','$
picname4','$// picname5','$picname6','$picname7','$picname8')";
//   mysql_query($sql) or die(mysql_error());
//  exec("cp $picname1 c:/sammiwww/pic/$picname1"); 
//  exec("cp $picname2 c:/sammiwww/pic/$picname2");
//  exec("cp $picname3 c:/sammiwww/pic/$picname3");
//  exec("cp $picname4 c:/sammiwww/pic/$picname4");
//  exec("cp $picname5 c:/sammiwww/pic/$picname5");
//  exec("cp $picname6 c:/sammiwww/pic/$picname6");
//  exec("cp $picname7 c:/sammiwww/pic/$picname7");
//  exec("cp $picname8 c:/sammiwww/pic/$picname8");
//     echo "First: $first<br>\n"; 
//     echo "Last: $last<br>\n"; 
//     echo "Age: $age<br>\n"; 
//     echo "Email: $email<br>\n"; 
//     echo "Location: $location<br>\n";
//     echo "Eye color: $eye<br>\n";
//     echo "Hair color: $hair<br>\n";
//     echo "Experience: $experience<br>\n";
//     echo "Aspirations: $aspirations<br>\n";
//     echo "Media Type: $mtype<br>\n";
//     echo "Photo 1: $picname1<br>\n";
//     echo "<img src=c:/sammiwww/pic/$picname1><br>\n";
//     echo "Photo 2: $picname2<br>\n";
//     echo "<img src=c:/sammiwww/pic/$picname2><br>\n";
//     echo "Photo 3: $picname3<br>\n";
//     echo "<img src=c:/sammiwww/pic/$picname3><br>\n";
//     echo "Photo 4: $picname4<br>\n"; 
//     echo "<img src=c:/sammiwww/pic/$picname4><br>\n";
//     echo "Photo 5: $picname5<br>\n"; 
//     echo "<img src=c:/sammiwww/pic/$picname5><br>\n";
//     echo "Photo 6: $picname6<br>\n";
//     echo "<img src=c:/sammiwww/pic/$picname6><br>\n";
//     echo "Photo 7: $picname7<br>\n";
//     echo "<img src=c:/sammiwww/pic/$picname7><br>\n";
//     echo "Photo 8: $picname8<br>\n";
//     echo "<img src=c:/sammiwww/pic/$picname8><br>\n";
//     echo  "<b><center>Thank you for registering,&nbsp; 
// $first </b></center><p>";
//  ?> 
// 
// 
// ---
// Outgoing mail is certified Virus Free.
// Checked by AVG anti-virus system (http://www.grisoft.com).
// Version: 6.0.427 / Virus Database: 240 - Release Date: 12/7/2002
// 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux