RE: [PHP] Upload Script Problem

From: Date: Sat, 19 Oct 2002 18:09:11 +0000
Subject: RE: [PHP] Upload Script Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120617@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 Try copy($filename,$new_file_name) The file is uploaded to the system temp directory, not /home/tabzilla/public_html/ more than likely. You might want to look at the move_uploaded_file() function, too. ---John Holmes...

« previous php.general (#120617) next »