Hello, this is what I have.... I was trying to do a input with a hidden tag but it doesn't seem to be working.. Anyone have any ideas or suggestions? thanks <?php $allowedExts = array("jpg", "jpeg", "gif", "png"); $extension = end(explode(".", $_FILES["photo"]["name"])); if ((($_FILES["photo"]["type"] == "image/gif") || ($_FILES["photo"]["type"] == "image/jpeg") || ($_FILES["photo"]["type"] == "image/png") || ($_FILES["photo"]["type"] == "image/pjpeg")) && ($_FILES["photo"]["size"] < 2000000) && in_array($extension, $allowedExts)) { if ($_FILES["photo"]["error"] > 0) { echo "Return Code: " . $_FILES["photo"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["photo"]["name"] . "<br>"; echo "Type: " . $_FILES["photo"]["type"] . "<br>"; echo "Size: " . ($_FILES["photo"]["size"] / 2024) . " kB<br>"; echo "Temp file: " . $_FILES["photo"]["tmp_name"] . "<br>"; if (file_exists("myphotos/" . $_FILES["photo"]["name"])) { echo $_FILES["photo"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["photo"]["tmp_name"], "mystock/" . $_FILES["photo"]["name"]); echo "Stored in: " . "myphotos/" . $_FILES["photo"]["name"]; } } } else { echo "Invalid file"; } ?> <form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST" enctype="multipart/form-data"> <label for="image"></label> - <input type="file" name="image1" id="image1" /> <input type="hidden" name="image1" id="image1" /> <BR /><BR /> <input type="submit" name="submit" id="submit" value="Submit" /> <input type="hidden" name="MM_insert" value="form1" /> </form> PHP:
I figured it out... it had to do with my GetSQLValueString instead of using $file I was using $post....
$target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } This code is very useful for you. you are upload any type of files and images.