General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 16th, 2003, 03:59 PM
Ara-Tech Ara-Tech is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Ara-Tech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Parse Error !! Made Me tired

Hi Mates ..
that is upload.php
I want to know where is the Parse Error .. !!
The problem is :-
PHP Code:
 Parse errorparse errorexpecting `'('' in c:\apache\htdocs\upload\upload.php on line 14 


let's see upload.php
PHP Code:
<html>
<
head>
<
titlesite name <title>
</
head>
</
html>
<?
$max_size=30000;
$allowed=array("html","php");
$upload_folder="http://localhost".$HTTP_POST_VARS['userfile']['tmp_name'];
if(
$F1=="") {
echo
"<br>You did not choose a File<br>";
}
else if
if(
$HTTP_POST_VARS['userfile']['size']>==$max_size)
{
echo
" The size is not accepted";
}
else if
if(
$HTTP_POST_VARS['userFile']['type']!==$allowed)
{
echo
" The kind of the file is not accepted ";
}
else if
{
@
copy($HTTP_POST_VARS['userfile']['tmp_name'],$upload_folder);
echo
"<br> echo $HTTP_POST_VARS['userfile']['name'];
echo"
<br$uploader_folder</br>
}
?>
</body>
</html> 


and i want to know How can compare
if the File name Founded in the directory ...
The File name is Founded , plz Change the name ...

Waiting For Helps

Reply With Quote
  #2  
Old December 16th, 2003, 05:08 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Your problem is here:

PHP Code:
else if
if(
$HTTP_POST_VARS['userfile']['size']>==$max_size)
{
echo
" The size is not accepted";
}
else if
 if(
$HTTP_POST_VARS['userFile']['type']!==$allowed)




An "else if" statement requires a condition in parentheses just as an "if" statement does. Try changing it to:

PHP Code:
else if($HTTP_POST_VARS['userfile']['size']>==$max_size)
{
echo
" The size is not accepted";
}
else if(
$HTTP_POST_VARS['userFile']['type']!==$allowed)


...



To check the filename, use the file_exists() function. I suggest combining that with a while loop and a counter that appends or prepends numbers to the end of the file while file_exists() returns true. This will prevent you from overwriting any renamed files with future files that need to be renamed.

Reply With Quote
  #3  
Old December 17th, 2003, 02:56 AM
Ara-Tech Ara-Tech is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 5 Ara-Tech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i edited it but also another Problems ...

the problem
Parse error: parse error, expecting `'('' in c:\apache\htdocs\upload\upload.php on line 23

and the code is
PHP Code:
<html>
<
head>
<
titlesite name <title>
</
head>
</
html>
<?
$max_size=30000;
$allowed=array("html","php");
$upload_folder="http://localhost".$HTTP_POST_VARS['userfile']['tmp_name'];
if(
$F1=="") {
echo
"<br>You did not choose a File<br>";
}

else if(
$HTTP_POST_VARS['userfile']['size']>=$max_size)
{
echo
" The size is not accepted";
}
else  if(
$HTTP_POST_VARS['userFile']['type']!==$allowed)
{
echo
" The kind of the file is not accepted ";
}
else if
{
copy($HTTP_POST_VARS['userfile']['tmp_name'],$upload_folder);
echo
"<br> echo $HTTP_POST_VARS['userfile']['name'];
echo"
<br$uploader_folder</br>
}
?>
</body>
</html> 

I hope you see The code well ...
If There any Problem ... Tell me
and about The file_exsit
PHP Code:
if(file_exists($HTTP_POST_VARS['userfile']['tmp_name']))
{
echo
"The File is exsist .. please Change The file ";
}; 


Best Regards

Reply With Quote
  #4  
Old December 17th, 2003, 08:04 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
You need to be sure all of your "else if" statements include a condition. Your last one (on line 23) does not have a condition in parentheses. If this is the default case that should occur if none of the other conditions are met, you should just use an else.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Parse Error !! Made Me tired


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT