file upload array problem

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

 



Hi everyone,

every time I try to upload a picture I get the same problem in return. First
of all, it's not being uploaded (but this is for later concern I'm afraid).
Trying to display the info of the (not)uploaded file should be done with:

$_FILES['picture']['name']

but every time I run this the return is a error like this:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\apache\htdocs\seabird.jmtech.ca\otf.com\submit.php on
line 69

If I leave out the qoutes it runs fine but my output (echo) is Array['name']

Running a FILES list gives correct names and everything. Where did this go
wrong??

Here's my code aswell.... please help me, don't point me to another website
or manual (have read a dozen, and I'm still stuck).

if ($_POST[submit]) {

$link = mysql_pconnect("localhost","myuser","mypass");
$db = test;
mysql_select_db($db,$link);

$query = "INSERT INTO inventory
(registration,type,total_time,price,description,picture_name)
VALUES
('$_POST[registration]','$_POST[type]','$_POST[total_time]','$_POST[price]',
'$_POST[description]','$_FILES[picture]')";

exec("cp $_FILES[picture]
http://localhost/seabird.jmtech.ca/otf.com/images/$_FILES[picture][name]";);

mysql_query( $query, $link);
print 'Thank you<br>You have submitted the following information:<br>';
echo "Registration: $_POST[registration]<br>\n";
echo "Type: $_POST[type]<br>\n";
echo "Total Time: $_POST[total_time]<br>\n";
echo "Price: $_POST[price]<br>\n";
echo "Description: $_POST[description]<br>\n";
echo "temp file: $_FILES[picture]<br>\n";
echo "file name: $_FILES[picture][name]<br>\n";
echo "file size: $_FILES[picture][size]<br>\n";
echo "file type: $_FILES[picture][type]<br>\n";
echo "<br>\n";
echo "<img src=images/$_FILES[picture][name]><br>\n";
}
else { ?>
    <form enctype="multipart/form-data" method="post"
action="<?php echo $PHP_SELF ?>">
      <p>Registration<br>
        <input type="Text" name="registration" size="25" value="N">
        <br>
        type<br>
        <input type="Text" name="type" size="25">
        <br>
        total time<br>
        <input type="Text" name="total_time" size="25">
        <br>
        price<br>
        <input type="Text" name="price" size="25">
        <br>
        Description<br>
        <textarea name="description"></textarea>
        <br>
        picture<br>
        <input type="file" name="picture" size="25">
        <input type="submit" name="submit" value="Upload">
      </p>
    </form>
    <?php
}
echo "<pre>";
print_r($_FILES);  // or use print_r($_POST) if you are using a POST instead
of a GET method for your form
echo "</pre>";
?>

--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching????



-- 
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