Loading ...
Sorry, an error occurred while loading the content.

Fw: [bang-phpug] upload image error

Expand Messages
  • Binu Raman
    Hello Pritesh, I think the attachment file I sent was removed by the yahoogroups server. Here are the files : index.php Image Upload
    Message 1 of 1 , Jun 28, 2006
    • 0 Attachment
      Hello Pritesh,

      I think the attachment file I sent was removed by the yahoogroups server.
      Here are the files :

      index.php

      <html>
      <head>
      <title>Image Upload Demo</title>
      </head>
      <body>
      <table>
      <form enctype="multipart/form-data" action="addimg.php" method="post" >
      <tr><td align="right">Image Name : </td><td><input type="text" name="iname"/></td></tr>
      <tr><td align="right">Image File : </td><td><input type="file" name="imagefile"/></td></tr>
      <tr><td colspan="2">Description : <br><textarea name="description" cols="40" rows="5" ></textarea></td></tr>
      <tr><td colspan="2" align="right"><input type="submit" value="Upload" name="upload" /></td></tr>
      </form>
      </table>
      </body>
      </html>

      addimg.php

      <?
      include("conn_connect.php" );
      if((substr($_FILES['imagefile']['type'],0,5) == "image"))
      {
      $iname=$_POST['iname'];
      $imageFile = "./uploads/".$_FILES['imagefile' ]['name'];
      echo "Name : ".$iname."<br/>";
      echo "Size : ".$_FILES['imagefile' ]['size'] ."<br />";
      echo "Type : ".$_FILES['imagefile' ]['type'] ."<br />";
      move_uploaded_file($_FILES['imagefile']['tmp_name' ],$imageFile) or die("Counld not upload.");
      $strdescription = addslashes(nl2br( $_POST['description']));
      $insert="insert into img_demo(iname,iadd,description) values('" . $iname . "','" . $imageFile . "','" . $strdescription . "')";
      mysql_query($insert,$conn);
      echo "Upload done!";
      }
      else
      {
      echo "Please upload an image file!";
      }
      ?>

      conn_connect.php

      <?
      $conn=mysql_connect("localhost","root","");
      mysql_select_db("property",$conn);
      ?>

      property.sql

      create table img_demo(
      id integer primary key auto_increment,
      iname varchar(100) ,
      iadd varchar(200) ,
      description text);




      Hoping to hear from you soon,

      With Regards,


      Binu Raman






      ----- Forwarded Message ----
      From: Binu Raman <binuraman9999@...>
      To: bang-phpug@yahoogroups.com
      Sent: Wednesday, 28 June, 2006 11:40:54 AM
      Subject: Re: [bang-phpug] upload image error

      Hello Pritesh,

      Here is the solution for u.
      I have just created your files itself and made the required modifications in it.

      I'm attaching the files herewith (test.zip).

      After extracting the contents, don't forget the following things :
      1. Create a folder named 'upload' in the folder where you are placing the extracted files.
      2. If your server system is linux, set the chmode of the 'upload' folder to '757'.
      3. Set the proper username and password in the 'conn_connect. php' file.

      Thats all.

      Now it should work.

      Please reply me back with ur results.

      with regards,

      Binu Raman

      ----- Original Message ----
      From: pritesh loke <priteshloke@ yahoo.com>
      To: bang-phpug@yahoogro ups.com
      Sent: Tuesday, 27 June, 2006 8:26:11 PM
      Subject: Re: [bang-phpug] upload image error

      Hello sir
      I used this code but still they not storing the path in the database . even i am also changing the imaga name but still they not insert in the database.



      Thank you

      ansar ansar <ansarahmed_ 8@ yahoo.co. in> wrote: Hi pritesh,

      use the below code i am using it and getting file in $_FILES

      <form enctype="multipart/ form-data" action="xml. php" method="POST" >
      Send this file: <input name="userfile" type="file" />
      <input type="submit" value="Send File" />
      </form>


      pritesh loke <priteshloke@ yahoo.com> wrote: Hello to all
      pls check my code i write for upload image but they not get file in $_FILES function
      upload.php
      <html>

      <form action="addimg. php" method="post" >
      <table>
      <tr>
      <td>Image Name : <input type="text" name="iname" /></td</tr>
      <tr>
      <td>Image File : <input type="file" name="image1" /></td>
      </tr>
      <tr>
      <td>Description : <textarea cols="10" rows="5" wrap="VIRTUAL" maxlength="255" name="description" ></textarea>
      <tr>
      <td>
      <input type="submit" value="Upload" name="upload" />
      </td>
      </tr>
      </form>

      </html>

      addimg.php
      <?
      include("conn_ connect.php" );
      if(($_FILES[ 'image1'] ['type']= ="image/gif" ))
      {
      $iname=$_POST[ 'iname'];
      $imageFile = $_FILES['image1' ]['$iname' ];
      echo "Name : ".$iname."<br />";
      echo "Size : ".$_FILES['image1' ]['size'] ."<br />";
      echo "Type : ".$_FILES['image1' ]['type'] ."<br />";
      copy($_FILES[ 'image1'] ['tmp_name' ],"http://localhost/ newphp/".$_FILES[ 'image1' ]['$iname' ]) or die("Counld not copy.") ;
      $strdescription = addslashes(nl2br( $_POST['descript ion']));

      $insert="insert into img_demo values('','$ iname','$ imageFile' ,'$strdescriptio n')";
      mysql_query( $insert,$ conn);
      echo "Copy done!";
      }
      else
      {
      echo "Please gif or jpeg file!";
      }?>

      conn_connect. php
      <?
      $conn=mysql_ connect(" localhost" ,"root"," pritesh") ;
      mysql_select_ db("property" ,$conn);
      ?>

      data file
      create table img_demo(
      id integer primary key auto_increment,
      iname varchar(100) ,
      iadd varchar(200) ,
      description text);

      Pls run and tell me the error.
      Thank you



      ------------ --------- --------- ---
      Yahoo! Groups gets better. Check out the new email design. Plus theres much more to come.

      [Non-text portions of this message have been removed]






      ------------ --------- --------- ---
      Yahoo! India Answers: Share what you know. Learn something new Click here
      Catch all the FIFA World Cup 2006 action on Yahoo! India Click here

      [Non-text portions of this message have been removed]





      ____________ _________ _________ _________ _________ __
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail. yahoo.com

      [Non-text portions of this message have been removed]





      [Non-text portions of this message have been removed]








      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.