#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Malaysia
    Posts
    5
    Rep Power
    0
    Greetings,

    Hey there,

    I using PHP 3.0.16, Apache Web Server. and MySQL 3.22.34 in my Win 98 machine.

    The problem that i had is when i want to upload a picture in php the error Warning: Unable to open 'php2' for reading:Unknown error in crogram filesapache groupapachehtdocsmansteradd.php3 on line 23
    .

    The sample of my coding is paste below. Can somebody help me to figure out what is the problem.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>mysql_select_db("manster");
    define( "PHOTODIR", "photos/");


    if ($submit) {
    if ($matrix=="") {
    $matrix = "N/A";
    }
    if ($name=="") {
    $name="N/A";
    }
    if ($email=="") {
    $email="N/A";
    }
    if ($picture!="none") {
    copy($picture, PHOTODIR.$picture_name);
    $query = "INSERT INTO student VALUES ('$matrix', '$name', '$email', 'photos/$picture_name')";
    $result = mysql_db_query("manster", $query);
    echo "<p>$name was added to the database</p>";
    }else{echo "wrong!";}
    }
    ?>
    <h1>Add an entry</h1>
    <form enctype="multipart/form-data" method="post">
    Matrix: <input type=text name='matrix'><br>
    Name: <input type=text name='name'><br>
    Email: <input type=text name='email'><br>
    Gambo: <INPUT TYPE=file NAME='picture' SIZE="30" ACCEPT="image/jpeg,image/gif,image/x-png"><br>
    <input type=submit name=submit value="Upload">
    </form>
    <p><a href="index.php3">Back to index</a>
    </font>
    </body>
    </html>[/code]

    Thanks in advance

  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    24
    Rep Power
    0
    You need to use the stripslashes function on the upload path.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    copy(stripslashes($picture), PHOTODIR.$picture_name);
    [/code]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Malaysia
    Posts
    5
    Rep Power
    0
    Thanks, really appreciate it?

    But what is the causes of the problem that i had. Seems that the code that i used is work smoothly in others computers?

    Anyway Thanks.

Similar Threads

  1. unable to keep IE open in more than 2 windows
    By himer in forum Windows Help
    Replies: 1
    Last Post: December 31st, 2003, 02:24 PM
  2. C++ Question
    By rave41799 in forum C Programming
    Replies: 8
    Last Post: December 21st, 2003, 04:39 AM
  3. Warning...Unable to open for reading..need help
    By phpnewb in forum PHP Development
    Replies: 5
    Last Post: December 11th, 2003, 10:15 AM
  4. DBI warnings -- plz help
    By pranesh in forum Perl Programming
    Replies: 4
    Last Post: December 1st, 2003, 07:52 PM
  5. Linking Problem in VC++6.0
    By sravan in forum C Programming
    Replies: 0
    Last Post: November 27th, 2003, 10:22 AM

IMN logo majestic logo threadwatch logo seochat tools logo