Hello,
I am trying to fix a upload script that doesn't seem to be working anymore. I had it up an running for a few months but it broke last week. I don't think that there was anything changed on the server. I am using php 4.0.4pl1. Any help you could give me would be great. I get this error when the script is run: Warning: Unable to open '' for reading: No such file or directory in /dir/on/webserver/upload.php on line 14 Here is line 14: copy($temp, "/dir/to/copy/to".$file); Here is the script: <?php $file = $HTTP_POST_FILES['file']['name']; $type = $HTTP_POST_FILES['file']['type']; $size = $HTTP_POST_FILES['file']['size']; $temp = $HTTP_POST_FILES['file']['tmp_name']; $size_limit = "1000000"; // set size limit in bytes $allowed_types = array("text/plain","text/html", "application/msword", "application/pdf"); if ($file){ if ($size < $size_limit){ if (in_array($type,$allowed_types)){ copy($temp, "/dir/to/copy/to".$file); } else { $bod = " <tr> <td colspan=\"2\"><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Sorry, files of type <tt>$type</tt> are not permitted</font></td> </tr> "; }} else { $bod = " <tr> <td colspan=\"2\"><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Sorry, your file exceeds the size limit of $size_limit bytes</font></td> </tr> "; }} echo " <html> <head> <title>Submit</title> </head> <body bottommargin=\"0\" rightmargin=\"0\"> <form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\"> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"380\"> $bod <tr> <td colspan=\"2\"><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Please fill out the form below and attach your CV. Also please don't use an apostrophe in your resume name. Thank you for your interest in WWMG.</font></td> </tr> <tr> <td colspan=\"2\"><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"> </font></td> </tr> <tr> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Name:</font></td> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"><input type=\"text\" name=\"name\" size=\"25\"></font></td> </tr> <tr> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Address:</font></td> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"><input type=\"text\" name=\"add\" size=\"40\"></font></td> </tr> <tr> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Phone:</font></td> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"><input type=\"text\" name=\"pnum\" size=\"25\"></font></td> </tr> <tr> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Email:</font></td> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"><input type=\"text\" name=\"email\" size=\"25\"></font></td> </tr> <tr> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\">Upload a file:</font></td> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"><input name=\"file\" type=\"file\" size=\"25\"></font></td> </tr> <tr> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"></font></td> <td><font face=\"verdana\" size=\"2\" color=\"#000000\" class=\"blacktext2\"><input type=\"submit\" value=\"Upload\"> <form method=\"post\" action=\"javascript:window.close();\"><input type=\"submit\" value=\"Cancel\" onclick=\"javascript:window.close();\"></form></font></td> </tr> </form> </table> </body> </html> "; ?> _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php