Newbie begginer Question
Moderator: General Moderators
-
friendlygiraffe
- Forum Newbie
- Posts: 6
- Joined: Mon Oct 28, 2002 5:00 pm
- Location: UK
Newbie begginer Question
Hello,
i'm completely new to PHP, so excuse me if this is a stupid question.
After I uploaded a simple php info script, which displays that my server has PHP 4 installed on it, i've been uploading example PHP scripts on my domian, but every time it comes up with the same error:
Parse error: parse error in mydomain/php/test.php on line 1
Am i doing something wrong??
Thanks in advance
i'm completely new to PHP, so excuse me if this is a stupid question.
After I uploaded a simple php info script, which displays that my server has PHP 4 installed on it, i've been uploading example PHP scripts on my domian, but every time it comes up with the same error:
Parse error: parse error in mydomain/php/test.php on line 1
Am i doing something wrong??
Thanks in advance
-
friendlygiraffe
- Forum Newbie
- Posts: 6
- Joined: Mon Oct 28, 2002 5:00 pm
- Location: UK
Hi,
This is the html:
<form action="upload.php" method="post" ENCTYPE="multipart/form-data">
<input type="file" size=40 name="file"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<input type="submit" value="upload">
</form>
This is the php:
<?
if ($file == "none") {
print "You must specify a file to upload";
}
else {
copy($file,http://www.falmouthphotos.co.uk/php/uploads);
unlink($file);
}
?>
Thanks
This is the html:
<form action="upload.php" method="post" ENCTYPE="multipart/form-data">
<input type="file" size=40 name="file"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<input type="submit" value="upload">
</form>
This is the php:
<?
if ($file == "none") {
print "You must specify a file to upload";
}
else {
copy($file,http://www.falmouthphotos.co.uk/php/uploads);
unlink($file);
}
?>
Thanks
some possible issues
I can see several reasons why the script could be dieing but not on line one.
Try this.
part of the problem was that you where trying to use a string without quotes around it. The url line was being read in but it either needed to be quoted or placed in a seperate variable such as I have done.
phpScott
Try this.
Code: Select all
<?php
if ($file == "") {
print "You must specify a file to upload";
}
else {
$upLoadDir="http://www.falmouthphotos.co.uk/php/uploads";
copy($file,$upLoadDir);
unlink($file);
}
?>phpScott
-
friendlygiraffe
- Forum Newbie
- Posts: 6
- Joined: Mon Oct 28, 2002 5:00 pm
- Location: UK
-
friendlygiraffe
- Forum Newbie
- Posts: 6
- Joined: Mon Oct 28, 2002 5:00 pm
- Location: UK
It's definately not cached - I've tried numerous scripts too:
Same error for all of them, maybe php is not installed correctly??
http://www.falmouthphotos.co.uk/php/calculater/
does it work for you guys? - Thanks for your time
Same error for all of them, maybe php is not installed correctly??
http://www.falmouthphotos.co.uk/php/calculater/
does it work for you guys? - Thanks for your time
-
friendlygiraffe
- Forum Newbie
- Posts: 6
- Joined: Mon Oct 28, 2002 5:00 pm
- Location: UK
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
-
friendlygiraffe
- Forum Newbie
- Posts: 6
- Joined: Mon Oct 28, 2002 5:00 pm
- Location: UK
It's just a sample script I got off evilWalrus, i've taken the '3' off, but it's still the same:
Html:
<form action="calculater.php" method="post">
<center><input type="text" name="num"> <select name="by"><option value="add">Add<option value="minus">Minus<option value="times">Multiply<option value="divide">Divide</select> <input type="text" name="num2"> <input type="submit" value="Calculate"></center>
</form>
php:
<?
if($by == "add"){
echo $num $num2;
} elseif($by == "minus"){
echo $num - $num2;
} elseif($by == "times"){
echo $num * $num2;
} elseif($by == "divide"){
echo $num / $num2;
}
?>
Thanks
Html:
<form action="calculater.php" method="post">
<center><input type="text" name="num"> <select name="by"><option value="add">Add<option value="minus">Minus<option value="times">Multiply<option value="divide">Divide</select> <input type="text" name="num2"> <input type="submit" value="Calculate"></center>
</form>
php:
<?
if($by == "add"){
echo $num $num2;
} elseif($by == "minus"){
echo $num - $num2;
} elseif($by == "times"){
echo $num * $num2;
} elseif($by == "divide"){
echo $num / $num2;
}
?>
Thanks