I had this working a day or two ago, then i added some stuff independent of the copy() part of the script, and it stopped working.
here's the info.
--form page--
<FORM METHOD="post" ACTION="upload.php">
<INPUT TYPE="file" NAME=file VALUE="">
<INPUT TYPE="submit" NAME="submit3" VALUE="Upload">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="200000000">
</FORM>
--upload.php--
<?php
$link = "<IMG SRC=\"../../gr/speaker.gif\"><FONT> $date <A HREF=\"http://bnc.mbhs.edu/radio/staff/shows/$file_name\">$title</A></FONT>\r\n";
$file = stripslashes($file);
if ($file_size > 2000000)
{
echo ("<FONT><CENTER>Your file is too large, please try to make it smaller, and upload it again.</CENTER></FONT>");
}
else
{
if (!copy($file,"shows/$file_name"))
{
echo ("<FONT><CENTER>Error Uploading File, Please try Again.</CENTER></FONT>");
}
else
{
$linkfile = "shows/listing.txt";
if ($fp = @fopen ($linkfile, "r"))
{
$oldlinks = @fread($fp,filesize($linkfile));
@fclose(fp);
}
$fp = fopen ($linkfile, "w");
fwrite ($fp, $link);
fwrite ($fp, $oldlinks);
fclose ($fp);
echo ("<FONT><CENTER>Success!</CENTER></FONT>");
}
}
?>
i didnt include the whole form, so the variables that look like they're missing probably aren't.
here's the error message i get
Warning: Unable to open 'C:\Documents and Settings\Administrator\My Documents\My Pictures\dylan\gary8.jpg' for reading: No such file or directory in /pinky/httpd/bnc/radio/staff/upload.php on line 17
line 17 is the copy function
so, how do i fix it?