line. parse error. "userfile_size>..."

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

hugon
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Nov 14, 2002 4:10 am

line. parse error. "userfile_size>..."

Postby hugon » Thu Nov 14, 2002 5:03 am

I keep getting parse error for this line

Code: Select all

if ($userfile_size > 524288000) { echo ("This file to big for saving at our server. Sorry!"); }


I've taken this from this forum. don't remember where.

form.html

Code: Select all

<form enctype=multipart/form-data action=add_pic.php method=post>
Which file??? <input name=picture type=file>
Your name is .... <input  type=text name=username>
<input type=submit value="OK!">
</form>



add_pic.php

Code: Select all

<?


// so if have a file we will save him, but we must test is this file a picture or not

$userfile_name=$HTTP_POST_FILES['picture']['name'];
$userfile_size=$HTTP_POST_FILES['picture']['size'];
$userfile_type=$HTTP_POST_FILES['picture']['type']

if ($userfile_size > 524288000) { echo ("This file to big for saving at our server. Sorry!"); }
if ($userfile_type == "image/gif"  or  $userfile_type == "image/jpeg" or $userfile_type == "image/png")
{
// In this case file is image and we are go to the dir where are pictures situated

// create a dir
$destination="upload/$username/"
mkdir ($destination, 0700); // I hope you want save pic into the $user - directory ...

$fd  =$destination;
$fd .=$$userfile_name;

if (file_exists($fd))
{
move_uploaded_file ($userfile_name, $destination);
copy($userfile_name);
echo("<a href=http://www.fruir.org/fileform/simple_hotmail/showpic.php?link=$fd>link</a>");
}

}

?>


showpic.php

Code: Select all

<?
echo("<img src=$link>");
?>

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: line. parse error. "userfile_size>..."

Postby WiZARD » Thu Nov 14, 2002 5:46 am

Hi!
As I see you so new in PHP.
You have few sintax error in your code

Code: Select all

<?


// so if have a file we will save him, but we must test is this file a picture or not

$userfile_name=$HTTP_POST_FILES['picture']['name'];
$userfile_size=$HTTP_POST_FILES['picture']['size'];
$userfile_type=$HTTP_POST_FILES['picture']['type'];

if ($userfile_size > 524288000) { echo ("This file to big for saving at our server. Sorry!"); }
if ($userfile_type == "image/gif"  or  $userfile_type == "image/jpeg" or $userfile_type == "image/png")
{
// In this case file is image and we are go to the dir where are pictures situated

// create a dir
$destination="upload/$username/";
mkdir ($destination, 0700); // I hope you want save pic into the $user - directory ...

$fd  =$destination;
$fd .=$$userfile_name;

if (file_exists($fd))
{
move_uploaded_file ($userfile_name, $destination);
copy($userfile_name);
echo("<a href=http://www.fruir.org/fileform/simple_hotmail/showpic.php?link=$fd>link</a>");
}

}



In next time see carefully :wink:


Return to “PHP coding => General”

Who is online

Users browsing this forum: krotbacca and 2 guests