--- In [email protected], "Robert" <[EMAIL PROTECTED]> wrote:
> This some code I found in a very helpful article at
> 
> 
> http://www.phpbuilder.com/columns/william19990908.php3?aid=41
> 
> printable version of the same article at:
> 
> 
> http://www.phpbuilder.com/columns/william19990908.php3?print_mode=1
> 
> 
> here is the code from the article
> 
> creating the table
> 
>    -> year INT(4),
>    -> make CHAR(20),
>    -> model CHAR(20),
>    -> price CHAR(15),
>    -> picture_name CHAR(25)
>    -> ); 
> 
> Creating a form to input the data from the net
> 
> form enctype="multipart/form-data" method="post"  action="<?php 
echo 
> $PHP_SELF ?>">
> year<br>
> <input type="Text" name="year" size="25">
> <br>
> make<br>
> <input type="Text" name="make" size="25">
> <br>
> model<br>
> <input type="Text" name="model" size="25">
> <br>
> price<br>
> <input type="Text" name="price" size="25">
> <br>
> picture<br>
> <input type="File" name="picture" size="25">
> <br><br>
> <input type="submit" name="submit" value="Upload">
> </form> 
> 
> 
> the form action
> 
> action="<?php echo $PHP_SELF ?>" 
> 
> 
> The php code:
> 
> <?php
> 
> if ($submit) {
> 
>     $db = mysql_connect("$localhost","$joesauto","$password");
> 
>     mysql_select_db("$joesauto",$db);
> 
>     $sql = "INSERT INTO joesauto 
> (year,make,model,price,picture_name) ".
>         "VALUES ('$year,$make,$model,$price,$picture_name')";
> 
>     exec("cp $picture /full/path/to/joesauto/images/$picture_name");
> 
>     echo "year: $year<br>\n";
>     echo "make: $make<br>\n";
>     echo "model: $model<br>\n";
>     echo "price: $price<br>\n";
>     echo "temp file: $picture<br>\n";
>     echo "file name: $picture_name<br>\n";
>     echo "file size: $picture_size<br>\n";
>     echo "file type: $picture_type<br>\n";
>     echo "<br>\n";
>     echo "<img src=images/$picture_name><br>\n";
> 
> }
> 
>  ?>
> I understand everything up until the php code's last five to six 
> lines. How did the author get "$picture_name" AND especially how id 
> he get the variables"$picture_size" and "$picture_type".
> 
> On the form that field element is named picture so the php 
varialble 
> should be named $picture, which I an see. But it seems he made of 
or 
> got from somewhere three extra varialbles with data somewhere. As I 
> said ESPECIALLY $picture_size and $picture_type confuses me.
> 
> Thanks

The author probably used the getimagesize() function that will show 
the type, width, height and mime type.

See http://www.php.net/manual/en/function.getimagesize.php

Also see http://www.php.net/manual/en/ref.image.php for requirements 
and other image handling functions.

Jim
Website Managers
http://www.websitemanagers.net





The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to