co.ador Posted July 27, 2011 Author Share Posted July 27, 2011 Guys thanks.. PMF thank you for the steps they help me I did all of them I declared and filter all the variables before validation and then process the image move_uploaded_ifle and the data field insert and worked much better. After the script check there is not error or Variable $errors is === 0 then I executed the move_uploaded script function. I realized too that the path was not being specified correctly I needed to specified from the root level. I just need to replace basename($_FILES['file']['name']) for $newname = $id.".jpg"; so that the name of the picture is equal to the id of the product. <?php if (0 === count($errors)){ // $newname = $id . ".jpg"; $uploaddir = '/home3/nyh/public_html/youryardsales/inventory_images/'; $uploadfile = $uploaddir . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } //rest of the code. ?> 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.