Forum Moderators: mack
I keep on getting this error. I'm new to PHP and i don't quite understand why i'm getting it, i checked the script and it looks fine to me but obviously i'm missing something here :(
this is my script(very very simple):
<?
if ($_FILES['img1']!= "") {
@copy($_FILES['img1']['tmp_name'], "c:\program files\apache group\apache2\htdocs\" .$_FILES['img1']['name']) or die ("Couldn't copy the file");
} else {
die("No input file specified");
}
?>
<html>
<head>
<title> Successfule file upload</title>
</head>
<body>
<h1> Success! <h1>
<p> You sent: <? echo $_FILES['img1']['name'];?>, a <? echo $_FILES['img1']['size'];?> byte file with a mime type of <? echo $_FILES['img1']['type'];?>.</p>
</body>
</html>
help please :(
Which is line 3?
We have a sweet little image upload script from Birdman that might help you out as well
Bag-O-Tricks for PHP II [webmasterworld.com]
msg #29
Line 3 would be:
@copy($_FILES['img1']['tmp_name'], "c:\program files\apache group\apache2\htdocs\" .$_FILES['img1']['name']) or die ("Couldn't copy the file");
i'm still looking at it now to try and figure this out =/
Oh and thank you for the script :) i'll be sure to try that one out too :)
also you might want to look at move_uploaded_file [ca2.php.net] as well.
@copy($_FILES['img1']['tmp_name'], "c:\program files\apache group\apache2\htdocs\" .$_FILES['img1']['name']) or die("Couldn't copy the file");
in the "c:\program files\apache group\apache2\htdocs\" i needed to include a second \ so that it looked like this:
@copy($_FILES['img1']['tmp_name'], "c:\program files\apache group\apache2\htdocs\\" .$_FILES['img1']['name']) or die("Couldn't copy the file");
thanks guys :)