Note that there are some explanatory texts on larger screens.

plurals
  1. POUploading image with validation not working
    primarykey
    data
    text
    <p>i have written a script to upload images,there are 2 input file upload to upload.. i have done validation in php to check which input is choosed or not so that table is not updated with blank if no image is choose.</p> <p>Problem is that it update table if i choose both image..but not when 1 is choosed.</p> <p><strong>Code:</strong></p> <pre><code>if ($_FILES["path"]["size"] &gt; 0 &amp;&amp; $_FILES["path1"]["size"] &lt; 0) { $allowedExts = array("jpg", "jpeg", "png"); $extension = end(explode(".", $_FILES["path"]["name"])); //echo $extension; if (($extension == "jpeg") || ($extension == "jpg") || ($extension == "png") ) { if ($_FILES["path"]["error"] &gt; 0) { $msg = $_FILES["path"]["error"] . "&lt;br /&gt;"; } else { move_uploaded_file($_FILES["path"]["tmp_name"], "../images/" . $_FILES["path"]["name"]); } $filename = "images/" . $_FILES["path"]["name"]; ///update query } } else if ($_FILES["path"]["size"] &lt; 0 &amp;&amp; $_FILES["path1"]["size"] &gt; 0) { $allowedExts = array("jpg", "jpeg", "png"); $extension = end(explode(".", $_FILES["path1"]["name"])); //echo $extension; if (($extension == "jpeg") || ($extension == "jpg") || ($extension == "png") ) { if ($_FILES["path1"]["error"] &gt; 0) { $msg = $_FILES["path1"]["error"] . "&lt;br /&gt;"; } else { move_uploaded_file($_FILES["path1"]["tmp_name"], "../images/" . $_FILES["path1"]["name"]); } $filename1 = "images/" . $_FILES["path1"]["name"]; ///update query } } else if ($_FILES["path"]["size"] &lt; 0 &amp;&amp; $_FILES["path1"]["size"] &lt; 0) { } else if ($_FILES["path"]["size"] &gt; 0 &amp;&amp; $_FILES["path1"]["size"] &gt; 0) { $allowedExts = array("jpg", "jpeg", "png"); $extension = end(explode(".", $_FILES["path"]["name"])); //echo $extension; if (($extension == "jpeg") || ($extension == "jpg") || ($extension == "png") ) { if ($_FILES["path"]["error"] &gt; 0) { $msg = $_FILES["path"]["error"] . "&lt;br /&gt;"; } else { move_uploaded_file($_FILES["path"]["tmp_name"], "../images/" . $_FILES["path"]["name"]); } $filename = "images/" . $_FILES["path"]["name"]; $allowedExtss = array("jpg", "jpeg", "png"); $extensions = end(explode(".", $_FILES["path1"]["name"])); //echo $extension; if (($extensions == "jpeg") || ($extensions == "jpg") || ($extensions == "png") ) { if ($_FILES["path1"]["error"] &gt; 0) { $msgs = $_FILES["path1"]["error"] . "&lt;br /&gt;"; } else { move_uploaded_file($_FILES["path1"]["tmp_name"], "../images/" . $_FILES["path1"]["name"]); } $filename1 = "images/" . $_FILES["path1"]["name"]; ///update query } header("Location: index.php?p=setings"); exit; </code></pre> <p>I have checked each and every thing but no error found.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload