associate user account with filename

associate user account with filename

am 14.09.2007 14:21:24 von Reggie

am trying to associate username with filename in a upload script.


I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42

This is my script any ideas.Am really stuck.


$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name
$target = "";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

//This is our size condition
$upload_size = $_FILES['uploaded']['size'];
if ($upload_size > 1000000000000)
{
echo "Your file is too large.
";
$ok=0;
}

//This is our limit file type condition
$upload_type = $_FILES['uploaded']['type'];
if ($upload_type =="text/php")
{
echo "No PHP files
";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".
basename( $_FILES['uploaded']['name']). " has been uploaded";
$myfilename=basename( $_FILES['uploaded']['name'])

mysql_connect("$host", "$username", "$password")or die("cannot
connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="update $tbl_name set filename = '$myfilename' WHERE
username='session_is_registered('myusername')' ";
mysql_query($sql);


}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>





Re: associate user account with filename

am 14.09.2007 14:27:59 von gosha bine

On 14.09.2007 14:21 Reggie wrote:
> am trying to associate username with filename in a upload script.
>
>
> I get this error:
> Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> clashoff.co.uk/user/htdocs/upload.php on line 42
>
> This is my script any ideas.Am really stuck.

The error has nothing to do with your actual problem. It's just a
parsing error, you're missing the comma or something like this. Check
line 42 of your script.



--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi

Re: associate user account with filename

am 14.09.2007 16:23:49 von Anonymous

Reggie wrote:
>
> am trying to associate username with filename in a upload script.
>
> I get this error:
> Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> clashoff.co.uk/user/htdocs/upload.php on line 42

Why don't you just look at line 42 then?

> $myfilename=basename( $_FILES['uploaded']['name'])
>
> mysql_connect("$host", "$username", "$password")or die("cannot
> connect");

Pretty obvious, you missed a semicolon in the line above 42.

Bye!

Re: associate user account with filename

am 14.09.2007 17:20:17 von Reggie

On Sep 14, 3:23 pm, Anonymous wrote:
> Reggie wrote:
>
> > am trying to associate username with filename in a upload script.
>
> > I get this error:
> > Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> > clashoff.co.uk/user/htdocs/upload.php on line 42
>
> Why don't you just look at line 42 then?
>
> > $myfilename=basename( $_FILES['uploaded']['name'])
>
> > mysql_connect("$host", "$username", "$password")or die("cannot
> > connect");
>
> Pretty obvious, you missed a semicolon in the line above 42.
>
> Bye!

Where did i miss a semicolon.I cant see it.Am new to PHP

Re: associate user account with filename

am 14.09.2007 17:25:55 von Larry Anderson

On Sep 14, 8:20 am, Reggie wrote:

>
> Where did i miss a semicolon.I cant see it.Am new to PHP

Little things like that happen all to often - to all of us. :-)

Re: associate user account with filename

am 14.09.2007 17:28:27 von Captain Paralytic

On 14 Sep, 16:20, Reggie wrote:
> On Sep 14, 3:23 pm, Anonymous wrote:
>
>
>
>
>
> > Reggie wrote:
>
> > > am trying to associate username with filename in a upload script.
>
> > > I get this error:
> > > Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> > > clashoff.co.uk/user/htdocs/upload.php on line 42
>
> > Why don't you just look at line 42 then?
>
> > > $myfilename=basename( $_FILES['uploaded']['name'])
>
> > > mysql_connect("$host", "$username", "$password")or die("cannot
> > > connect");
>
> > Pretty obvious, you missed a semicolon in the line above 42.
>
> > Bye!
>
> Where did i miss a semicolon.I cant see it.Am new to PHP- Hide quoted text -
>
> - Show quoted text -

Of course you can't see it, it's not there! that is what missing
means.

Look at line 41, it has no semicolon, so php carries on reading to
line 42 and finds a string, when by now it should have had a semicolon.

Re: associate user account with filename

am 14.09.2007 20:41:15 von Anonymous

Reggie wrote:
>
> On Sep 14, 3:23 pm, Anonymous wrote:
> > Reggie wrote:
> >
> > > am trying to associate username with filename in a upload script.
> >
> > > I get this error:
> > > Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> > > clashoff.co.uk/user/htdocs/upload.php on line 42
> >
> > Why don't you just look at line 42 then?
> >
> > > $myfilename=basename( $_FILES['uploaded']['name'])
> >
> > > mysql_connect("$host", "$username", "$password")or die("cannot
> > > connect");
> >
> > Pretty obvious, you missed a semicolon in the line above 42.
> >
> > Bye!
>
> Where did i miss a semicolon.I cant see it.Am new to PHP

You missed it here:

$myfilename=basename( $_FILES['uploaded']['name']) <-