question about uploading files

From: Date: Sun, 26 Nov 2000 00:50:06 +0000
Subject: question about uploading files
Groups: php.general 
Request: Send a blank email to php-general+get-27205@lists.php.net to get a copy of this message
Hey everyone. OK, here's my issue, I've installed PHP 4.0 on my win98 machine, running Apache as the Webserver. Now, I've downloaded a few scripts that should allow me to upload a file that I specify and put that file in a directory where I can look at it later. I'm trying to make a photo gallery so people can upload files and then view what everyone has uploaded. When I run any script to do this, I get an error that it can't write to the directory. here is a copy of one I found on the web that should work and others have had great success with. It should work, but I get an error that it can't be copied. Do I need to try something else? Did I screw up my installation? Do I need to change permissions in Apache or PHP somewhere? I wouldn't think so, but maybe I overlooked something. Please help. Thanks. Darrin <?php function do_upload($filename,$newname) { $file = basename($filename); $tmp_upload_path = "c:\\apache\\htdocs\\temp\\"; $new_file_name = "c:\\apache\\htdocs\\picture\\".$newname; if (!copy($tmp_upload_path.$file, $new_file_name)) echo "failed to copy file<br>\n"; return; } ?> <HTML> <HEAD> <TITLE>PHP - file upload</TITLE> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 10pt} --> </style> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080"> <?php do_upload($userfile,$newname); ?> <TABLE> <TR> <TD><b>upload report</b></TD><TD></TD> </TR> <TR> <TD>upload tmp file:</TD><TD><?php echo $userfile; ?></TD> </TR> <TR> <TD>file name:</TD><TD><?php echo $userfile_name; ?></TD> </TR> <TR> <TD>target file name:</TD><TD><?php echo $newname; ?></TD> </TR> <TR> <TD>target directory:</TD><TD>c:\apache\htdocs\picture\</TD> </TR> <TR> <TD>file size:</TD><TD><?php echo $userfile_size; ?></TD> </TR> <TR> <TD>file type:</TD><TD><?php echo $userfile_type; ?></TD> </TR> </TABLE> </BODY> </HTML>

« previous php.general (#27205) next »