uploading problems...please help

From: Date: Sat, 24 Aug 2002 21:53:25 +0000
Subject: uploading problems...please help
Groups: php.general 
Request: Send a blank email to php-general+get-113981@lists.php.net to get a copy of this message
I'm trying to upload files from my PC to my website. The code is a little nuts, but it's all I got to work locally, butonce I take the code to the web I get this message. Can anyone tell me what I'm doing wrong? I'm trying to upload a file, strip all the information so as to just use the name of the file to store in the database. I'm using explode and array_pop for this, but I'm sure there's a better way. The problem seems to be in writing the file to the web server. I changed the permissions on the directories, so I don't think that's the problem. Please help. Thanks, Brian ---------------ERROR FROM WEB SERVER--------------- Warning: Unable to open 'D:\harley\images\DSC00447.jpg' for reading: No such file or directory in /public_html/harleyuppic_fsp.php on line 19 ---------------PHP CODE---------------- <body> <?php if ($submit) { $db = mysql_connect("localhost", "user", "password") or die("Could not connect to databse."); mysql_select_db("database") or die("Cannot select database"); $hope2 = explode("\\",$imagefile); $hope4 = array_pop($hope2); copy ($imagefile, "\\public_html\\images\\".$hope4); mysql_query ("insert into imagefiles (img) values ('$hope4')"); $sql = "select img from imagefiles"; $result = mysql_query($sql) or die( mysql_error() ); $number_cols = mysql_num_fields($result); //layout table header echo "<table border = 1>\n"; echo "<tr align=center>\n"; for ($i=0; $i<$number_cols; $i++) { echo "<th>" . mysql_field_name($result, $i). "</th>\n"; } echo "</tr>\n";//end table header //layout table body while ($row = mysql_fetch_row($result)) { echo "<tr align=left>\n"; for ($i=0; $i<$number_cols; $i++) { echo "<td>"; {echo "<img src='$row[$i]'>";} {echo $row[$i];} echo "</td>\n"; } echo "</tr>\n"; } echo "</table>"; } else { ?> <form method="post" action="<?php echo $PHP_SELF?>"> <form enctype="multipart/form-data" action="admin_product.php" method ="post"> <input type=file name="imagefile"> <br> <input type="Submit" name="submit" value="Add picture to database"> </form> </form> <?php } // end if ?> </body>

« previous php.general (#113981) next »