Stephen, Here's how I did a similar thing for LearnGuitar.net. It enables members to upload songs for their music station. $root_dir = "d:/web/uploaded_songs/"; $folder = "$student_id"; $continue = "yes"; if (!is_dir("$root_dir/$folder")) { //echo "the directory does not exist yet so I'll create it"; if (!mkdir("$root_dir/$folder", "0700")) { echo "<tr><td class='headblack'>Error - couldn't create directory!</td></tr>"; $continue = "no"; echo "got here"; } } $filename = $HTTP_POST_FILES["userfile"]["name"]; $temp_file = $HTTP_POST_FILES["userfile"]["tmp_name"]; $file_type = $HTTP_POST_FILES["userfile"]["type"]; //echo "filename is $filename<br>\n"; if ((is_file("$root_dir/$folder/$filename")) && ($continue == "yes")) { echo "<tr><td class='headblack'>You have already submitted a song with the same file name."; $continue = "no"; } if (($file_type == "audio/mpeg") && ($continue == "yes")) { if (copy($temp_file, "$root_dir/$folder/$filename")) { echo "<tr><td class='headblack'>Thank you for submitting your Song!</td></tr>"; $msg = "$first_name $last_name ($email) submitted a song. Folder/File Name: uploaded_songs/$folder/$filename Name of Song: $song_name Is this song a cover or original? $song_type If original, who wrote the song? $songwriter Musicians: $musicians Is this song copyrighted? $copyrighted Musical Syles: $music_styles"; $mailto = "rickn@learnguitar.net"; //$mailto = "steiner277@charter.net"; $mail_subject = "PGS - song submission from $first_name $last_name"; $from = "From: lessons@learnguitar.net\n"; $replyto = "Reply-to: $mailto\n\n"; // should go to Web site to respond mail($mailto, $mail_subject, $msg, $from, $replyto); } else { echo "<tr><td class='headblack'>Error - There was a problem uploading your file.</td></tr>"; $continue = "no"; } } // *** end of if (is_file("$root_dir/$folder/$filename")) *** elseif ($continue == "yes") { echo "<tr><td class='headblack'>The file type is not correct. We only accept MP3 files.</td></tr>"; } ---------------------- Beverly Steiner steiner277@charter.net -----Original Message----- From: Stephen K Knight [mailto:stephen@fmwebschool.com] Sent: Friday, March 07, 2003 12:50 AM To: php-db@lists.php.net Subject: I need some help with php code please I am trying to upload an image to my webserver. This is the PHP page that is called from my html page. I am trying to upload the image to my folder called "logos" the direct link would be: C:\Program Files\Apache Group\Apache2\htdocs\logos I am not sure what I am doing wrong in the code below. Can someone please look and help me so that I can upload the image to that folder. Thank you! In Kindness Stephen K Knight <? if(!empty($userfile)) { $abpath = "/logos/" . $newname; echo "FileUpload2.php"; echo $username; echo $newname; echo $abpath; //copy the file // copy($userfile, "$abpath"); //destroy the uploaded file // unlink($userfile); // write javascript to store the newname // echo "<script language='javascript'>\n"; // echo "newname = '" . $newname . "';\n"; // echo "</script>\n"; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php