Upload Script Problem

From: Date: Sat, 19 Oct 2002 17:58:46 +0000
Subject: Upload Script Problem
Groups: php.general 
Request: Send a blank email to php-general+get-120615@lists.php.net to get a copy of this message
I have a bug in my file upload script, the error i get returned is: Warning: Unable to open '/home/tabzilla/public_html/phpvj2Bg5' for reading: No such file or directory in /home/tabzilla/public_html/doadd.php on line 9 failed to copy file when trying to upload a file called SLIME.TXT. Here is the form code: <form action="doadd.php" enctype="multipart/form-data" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="10000"><input type="File" name="userfile" size="30" maxlength="255"> <input type="submit" name="submit" value="Add Tab/Lyric"> </form> Here is the action script to handle uploading the file... <?php require("settings.php"); require("common.php"); function do_upload($filename,$newname) { $file = basename($filename); $tmp_upload_path = "/home/tabzilla/public_html/"; $new_file_name = "/home/tabzilla/public_html/" . $newname; if (!copy($tmp_upload_path.$file, $new_file_name)) { echo "failed to copy file<br>\n"; exit(); } } $newname = "upload.txt"; do_upload($userfile, $newname); $fp = fopen("upload.txt", "r"); $content = fread($fp, 10240); fclose($fp); unlink("upload.txt"); ?> If anyone has any ideas i would love to hear them. Thankyou.

« previous php.general (#120615) next »