Re: file upload array problem

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

 



On Saturday 21 December 2002 05:25, Seabird wrote:
> 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

Which is 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]) {

If you have error reporting set high enough you would have seen a warning 
about "Use of undefined constant submit...". You should use:

  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]')";

If you're referring to array variables inside a double-quoted string you 
should enclose it within {}. Thus:

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

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
The keyboard isn't plugged in
*/


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