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

Need Help form you

Expand Messages
  • Mohammad abu taleb
    I want to copy an image from user pc to my server pc. Please send the code. I try the flowing code but it work in server Pc but if the user pc want to upload
    Message 1 of 6 , May 11, 2005
      I want to copy an image from user pc to my server pc.
      Please send the code.
       
      I try the flowing code but it work in server Pc but if the user pc want to upload an image it show error
       
      =========CODE=================
      $filemain = basename ($mainphoto);
      if($filemain)
       {
        $img_main=$uid.'_'.$filemain;
        $img_src=$mainphoto;
        $img_des= $des.$img_main;
        
        echo 'Source  :'.$img_src;
        echo ' >> Dest  :'.$img_des;
        
           if (!copy($img_src,$img_des))
         {
             print ("failed to copy $file...<br>\n");
         }
            else {echo "Image Uploaded" ;
         // update image into db
          $sqlselphoto="UPDATE `image` SET `img_main`='$img_main' WHERE `saleid` = '$rid' ";
          $photorun = mysql_query($sqlselphoto,$db);
                //echo $sqlselphoto;
           }
       }//if file name
      ========EnD===============
       
      Please help me
      bye
      SHIMUL
       


      Yahoo! Mail
      Stay connected, organized, and protected. Take the tour
    • Karuanakar Chowdary Gadde
      Hi , Please check the following link to upload files from client computer to server. http://in.php.net/manual/en/function.move-uploaded-file.php Karunakar
      Message 2 of 6 , May 11, 2005
        Hi ,
         
        Please check the following link to upload files from client computer to server.
         
         
        Karunakar Gadde

        Mohammad abu taleb <simul14@...> wrote:
        I want to copy an image from user pc to my server pc.
        Please send the code.
         
        I try the flowing code but it work in server Pc but if the user pc want to upload an image it show error
         
        =========CODE=================
        $filemain = basename ($mainphoto);
        if($filemain)
         {
          $img_main=$uid.'_'.$filemain;
          $img_src=$mainphoto;
          $img_des= $des.$img_main;
          
          echo 'Source  :'.$img_src;
          echo ' >> Dest  :'.$img_des;
          
             if (!copy($img_src,$img_des))
           {
               print ("failed to copy $file...<br>\n");
           }
              else {echo "Image Uploaded" ;
           // update image into db
            $sqlselphoto="UPDATE `image` SET `img_main`='$img_main' WHERE `saleid` = '$rid' ";
            $photorun = mysql_query($sqlselphoto,$db);
                  //echo $sqlselphoto;
             }
         }//if file name
        ========EnD===============
         
        Please help me
        bye
        SHIMUL
         


        Yahoo! Mail
        Stay connected, organized, and protected. Take the tour

        Visit Dynamic URL Shortening System : http://www.magicurl.info



        KARUNA KARA RAO GADDE


        Do you Yahoo!?
        Yahoo! Small Business - Try our new resources site!

      • jphp0xhasan
        Your code is not clear to me... If u want to copy image from user pc to server pc u must need to follow these steps: STEP 1. ... User Must use any HTTP client
        Message 3 of 6 , May 11, 2005
          Your code is not clear to me...
          If u want to copy image from user pc to server pc u must need to
          follow these steps:

          STEP 1.
          ---------------------------------------------------------
          User Must use any HTTP client software like IE, FireFox, NetScape,
          Opera, etc....
          (though u can send through your own software, u can do it just opening
          socket....)

          STEP 2.
          ---------------------------------------------------------
          User will select image file using File Field (<input type="file" ..../>)

          STEP 3.
          ---------------------------------------------------------
          And HTML page must contain 'encytype="multipart/form-data"' attribute

          STEP 4.
          ---------------------------------------------------------
          In Submit handler page will get one array..
          Like: $_FILE['userImage'];

          STEP 5.
          ---------------------------------------------------------
          Now u can use "move_uploaded_file()" function to copy ur uploaded tmp
          file ..

          STEP 6.
          ----------------------------------------------------------
          Now delete the uploaded tmp file using "unlink($fileName)"

          STEP 7.
          ----------------------------------------------------------
          One example:

          /*******************************************************
          *** HTML (select_image.html) ***
          ********************************************************/
          <html>
          <body>
          <form action="upload.php" method="post" enctype="multipart/form-data">
          Select Image: <input type="file" name="userImage" />
          <input type="submit" value="Upload" />
          </form>
          </body>
          </html>



          /*******************************************************
          *** PHP File (upload.php) ***
          ********************************************************/
          <?php
          // get submited file's attributes
          $userImage=$_FILE["userImage"];

          // get temp. file name
          $tmpFile=$userImage["tmp_name"];

          // create one random image name
          $imageName=md5(date("dmyhis").rand());

          // now move to user desired location
          if(move_uploaded_file($tmpFile, $yourNewUploadedImageLocation)) {
          unlink($tmpFile);
          }
          else {
          echo ":(";
          }

          ?>

          STEP 8.
          ---------------------------------------------------------------
          Smily :) :-]


          --- In phpexperts@yahoogroups.com, Mohammad abu taleb <simul14@y...>
          wrote:
          > I want to copy an image from user pc to my server pc.
          > Please send the code.
          >
          > I try the flowing code but it work in server Pc but if the user pc
          want to upload an image it show error
          >
          > =========CODE=================
          > $filemain = basename ($mainphoto);
          > if($filemain)
          > {
          > $img_main=$uid.'_'.$filemain;
          > $img_src=$mainphoto;
          > $img_des= $des.$img_main;
          >
          > echo 'Source :'.$img_src;
          > echo ' >> Dest :'.$img_des;
          >
          > if (!copy($img_src,$img_des))
          > {
          > print ("failed to copy $file...<br>\n");
          > }
          > else {echo "Image Uploaded" ;
          > // update image into db
          > $sqlselphoto="UPDATE `image` SET `img_main`='$img_main' WHERE
          `saleid` = '$rid' ";
          > $photorun = mysql_query($sqlselphoto,$db);
          > //echo $sqlselphoto;
          > }
          > }//if file name
          >
          > ========EnD===============
          >
          > Please help me
          > bye
          > SHIMUL
          >
          >
          >
          > ---------------------------------
          > Yahoo! Mail
          > Stay connected, organized, and protected. Take the tour
        • Mohammad abu taleb
          tnx for your replay. Now I want to delete that file... but I have not find any function in php.net. please send me any ... Karuanakar Chowdary Gadde
          Message 4 of 6 , May 11, 2005
            tnx for your replay.
             
            Now I want to delete that file...
            but I have not find any function in php.net.
             
            please send me any ...

            Karuanakar Chowdary Gadde <karuna_gadde@...> wrote:
            Hi ,
             
            Please check the following link to upload files from client computer to server.
             
             
            Karunakar Gadde

            Mohammad abu taleb <simul14@...> wrote:
            I want to copy an image from user pc to my server pc.
            Please send the code.
             
            I try the flowing code but it work in server Pc but if the user pc want to upload an image it show error
             
            =========CODE=================
            $filemain = basename ($mainphoto);
            if($filemain)
             {
              $img_main=$uid.'_'.$filemain;
              $img_src=$mainphoto;
              $img_des= $des.$img_main;
              
              echo 'Source  :'.$img_src;
              echo ' >> Dest  :'.$img_des;
              
                 if (!copy($img_src,$img_des))
               {
                   print ("failed to copy $file...<br>\n");
               }
                  else {echo "Image Uploaded" ;
               // update image into db
                $sqlselphoto="UPDATE `image` SET `img_main`='$img_main' WHERE `saleid` = '$rid' ";
                $photorun = mysql_query($sqlselphoto,$db);
                      //echo $sqlselphoto;
                 }
             }//if file name
            ========EnD===============
             
            Please help me
            bye
            SHIMUL
             


            Yahoo! Mail
            Stay connected, organized, and protected. Take the tour

            Visit Dynamic URL Shortening System : http://www.magicurl.info



            KARUNA KARA RAO GADDE


            Do you Yahoo!?
            Yahoo! Small Business - Try our new resources site!

            Visit Dynamic URL Shortening System : http://www.magicurl.info


            Discover Yahoo!
            Stay in touch with email, IM, photo sharing & more. Check it out!

          • Shadow Warrior
            Hi, see Unlink function for this Thanks Hasin ... to server. ... want to upload an image it show error ... `saleid` = $rid ;
            Message 5 of 6 , May 11, 2005
              Hi,
              see Unlink function for this

              Thanks
              Hasin

              --- In phpexperts@yahoogroups.com, Mohammad abu taleb <simul14@y...>
              wrote:
              > tnx for your replay.
              >
              > Now I want to delete that file...
              > but I have not find any function in php.net.
              >
              > please send me any ...
              >
              > Karuanakar Chowdary Gadde <karuna_gadde@y...> wrote:
              > Hi ,
              >
              > Please check the following link to upload files from client computer
              to server.
              >
              > http://in.php.net/manual/en/function.move-uploaded-file.php
              >
              > Karunakar Gadde
              >
              > Mohammad abu taleb <simul14@y...> wrote:
              > I want to copy an image from user pc to my server pc.
              > Please send the code.
              >
              > I try the flowing code but it work in server Pc but if the user pc
              want to upload an image it show error
              >
              > =========CODE=================
              > $filemain = basename ($mainphoto);
              > if($filemain)
              > {
              > $img_main=$uid.'_'.$filemain;
              > $img_src=$mainphoto;
              > $img_des= $des.$img_main;
              >
              > echo 'Source :'.$img_src;
              > echo ' >> Dest :'.$img_des;
              >
              > if (!copy($img_src,$img_des))
              > {
              > print ("failed to copy $file...<br>\n");
              > }
              > else {echo "Image Uploaded" ;
              > // update image into db
              > $sqlselphoto="UPDATE `image` SET `img_main`='$img_main' WHERE
              `saleid` = '$rid' ";
              > $photorun = mysql_query($sqlselphoto,$db);
              > //echo $sqlselphoto;
              > }
              > }//if file name
              >
              > ========EnD===============
              >
              > Please help me
              > bye
              > SHIMUL
              >
              >
              >
              > ---------------------------------
              > Yahoo! Mail
              > Stay connected, organized, and protected. Take the tour
              >
              > Visit Dynamic URL Shortening System : http://www.magicurl.info
              >
              >
              >
              > KARUNA KARA RAO GADDE
              >
              >
              >
              > ---------------------------------
              > Do you Yahoo!?
              > Yahoo! Small Business - Try our new resources site!
              >
              > Visit Dynamic URL Shortening System : http://www.magicurl.info
              >
              >
              >
              > ---------------------------------
              > Yahoo! Groups Links
              >
              > To visit your group on the web, go to:
              > http://groups.yahoo.com/group/phpexperts/
              >
              > To unsubscribe from this group, send an email to:
              > phpexperts-unsubscribe@yahoogroups.com
              >
              > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
              >
              >
              >
              > ---------------------------------
              > Discover Yahoo!
              > Stay in touch with email, IM, photo sharing & more. Check it out!
            • Mohammad abu taleb
              HI! tnx boss You code help me verymuch. But if I want to delete the image when the record is deleted. I tried but hang in $userImage=$_FILE[ userImage ]; if i
              Message 6 of 6 , May 11, 2005
                HI! tnx boss
                You code help me verymuch.
                But if I want to delete the image when the record is deleted.
                I tried but hang in
                 
                $userImage=$_FILE["userImage"];
                if i want to put userImage is a veriable like $userImage and
                $userImage=$_FILE[$userImage];
                but it does not work..

                jphp0xhasan <hasan83bd@...> wrote:
                Your code is not clear to me...
                If u want to copy image from user pc to server pc u must need to
                follow these steps:

                STEP 1.
                ---------------------------------------------------------
                User Must use any HTTP client software like IE, FireFox, NetScape,
                Opera, etc....
                (though u can send through your own software, u can do it just opening
                socket....)

                STEP 2.
                ---------------------------------------------------------
                User will select image file using File Field (<input type="file" ..../>)

                STEP 3.
                ---------------------------------------------------------
                And HTML page must contain 'encytype="multipart/form-data"' attribute

                STEP 4.
                ---------------------------------------------------------
                In Submit handler page will get one array..
                Like: $_FILE['userImage'];

                STEP 5.
                ---------------------------------------------------------
                Now u can use "move_uploaded_file()" function to copy ur uploaded tmp
                file ..

                STEP 6.
                ----------------------------------------------------------
                Now delete the uploaded tmp file using "unlink($fileName)"

                STEP 7.
                ----------------------------------------------------------
                One example:

                /*******************************************************
                ***               HTML (select_image.html)           ***
                ********************************************************/
                <html>
                <body>
                <form action="upload.php" method="post" enctype="multipart/form-data">
                Select Image: <input type="file" name="userImage" />
                <input type="submit" value="Upload" />
                </form>
                </body>
                </html>



                /*******************************************************
                ***                PHP File (upload.php)             ***
                ********************************************************/
                <?php
                // get submited file's attributes
                $userImage=$_FILE["userImage"];

                // get temp. file name
                $tmpFile=$userImage["tmp_name"];

                // create one random image name
                $imageName=md5(date("dmyhis").rand());

                // now move to user desired location
                if(move_uploaded_file($tmpFile, $yourNewUploadedImageLocation)) {
                  unlink($tmpFile);
                }
                else {
                  echo ":(";
                }

                ?>

                STEP 8.
                ---------------------------------------------------------------
                Smily :) :-]


                --- In phpexperts@yahoogroups.com, Mohammad abu taleb <simul14@y...>
                wrote:
                > I want to copy an image from user pc to my server pc.
                > Please send the code.

                > I try the flowing code but it work in server Pc but if the user pc
                want to upload an image it show error

                > =========CODE=================
                > $filemain = basename ($mainphoto);
                > if($filemain)
                >  {
                >   $img_main=$uid.'_'.$filemain;
                >   $img_src=$mainphoto;
                >   $img_des= $des.$img_main;
                >  
                >   echo 'Source  :'.$img_src;
                >   echo ' >> Dest  :'.$img_des;
                >  
                >      if (!copy($img_src,$img_des))
                >    {
                >        print ("failed to copy $file...<br>\n");
                >    }
                >       else {echo "Image Uploaded" ;
                >    // update image into db
                >     $sqlselphoto="UPDATE `image` SET `img_main`='$img_main' WHERE
                `saleid` = '$rid' ";
                >     $photorun = mysql_query($sqlselphoto,$db);
                >           //echo $sqlselphoto;
                >      }
                >  }//if file name
                >
                > ========EnD===============

                > Please help me
                > bye
                > SHIMUL

                >
                >            
                > ---------------------------------
                > Yahoo! Mail
                >  Stay connected, organized, and protected. Take the tour






                Visit Dynamic URL Shortening System : http://www.magicurl.info


                Do you Yahoo!?
                Make Yahoo! your home page

              Your message has been successfully submitted and would be delivered to recipients shortly.