Jump to content

uploading


salhzmzm

Recommended Posts

hi

I want the user can upload just three images

 

so how I can do this?

 

help me please.

 

thanks.

Okay, we really can't be spoon-feeding you.

 

To develop a script, you have to think about it.

 

Follow this plan:

- Identify what your script's purpose is. What is it going to do?

- Think of possible ways of going about coding this script. How can you do this? Are there more solutions to the problem?

- Code it.

- Test it. Is it working properly? If not, identify the problem, find the cause, and solve the new problem. :)

- Evaluate it. Could you have done it any better? If so, make modifications to it.

Link to comment
Share on other sites

this code I write it yesterday and I don't know why he didn't work

 

<?php

$che=0;

if(isset($up)){

if ($che==$si)

{

  ?>

<script language="JavaScript">

          alert("can't upload any more files");

</script>

<?php

}

else {

if (($_FILES["file"]["type"] == "image/gif")

|| ($_FILES["file"]["type"] == "image/jpeg")

|| ($_FILES["file"]["type"] == "image/bmp")

|| ($_FILES["file"]["type"] == "image/x-png")

|| ($_FILES["file"]["type"] == "image/pjpeg"))

{

  if ($_FILES["file"]["error"] > 0)

    {

    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";

    }

  else

    {

if (file_exists("../product/" . $_FILES["file"]["name"]))

      {

  ?>

<script language="JavaScript">

          alert("the image is exist");

</script>

<?php

      }

    else {

          $imgsize = getimagesize($_FILES["file"]["tmp_name"]);

          if ($imgsize[0]==$wi && $imgsize[1]==$gh) {

      copy($_FILES["file"]["tmp_name"],"../product/".$_FILES["file"]["name"]) or die("<b>Unknown error!</b>");

  $che++;

  ?>

<script language="JavaScript">

          alert("<?php

  echo "the image number " . $che . "has been uploaded";

  ?>");

</script>

<?php

 

      }

      else {

        ?>

<script language="JavaScript">

          alert("<?php

  echo "width & height ????";

  ?>");

</script>

<?php

 

      }

      }

    }

  }

else

  {

  ?>

<script language="JavaScript">

          alert("just image files can be uploaded");

</script>

<?php

  }

}

 

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.