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
https://forums.phpfreaks.com/topic/85676-uploading/#findComment-437254
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
https://forums.phpfreaks.com/topic/85676-uploading/#findComment-437256
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.