salhzmzm Posted January 12, 2008 Share Posted January 12, 2008 hi I want the user can upload just three images so how I can do this? help me please. thanks. Quote Link to comment Share on other sites More sharing options...
twostars Posted January 12, 2008 Share Posted January 12, 2008 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. Quote Link to comment Share on other sites More sharing options...
salhzmzm Posted January 12, 2008 Author Share Posted January 12, 2008 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 } } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.