byrne86 Posted November 18, 2010 Share Posted November 18, 2010 All I want to do is upload an image to my images folder, which is on the site root, so mysite.com/images here is my code: <form action="uploadimage.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <p> <label>Choose image to upload <input type="file" name="image" id="image" /> </label> </p> <p> <label> <input type="submit" name="imageupload" id="imageupload" value="Upload Image" /> </label> </p> </form> <?php $imagename = "1testimage"; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png"))) move_uploaded_file ($_FILES["file"]["tmp_name"],"images/" . $imagename.".gif"); ?> Cn anyone see why this is not working/ I have chenged the permissions on my hosting account to read and write... Link to comment https://forums.phpfreaks.com/topic/219123-help-with-image-uploader/ Share on other sites More sharing options...
JasonLewis Posted November 19, 2010 Share Posted November 19, 2010 You named your file field 'image', however you're referencing 'file' in the $_FILES array. Change all occurrences of $_FILES["file"] to $_FILES['image'], then see how you go. Link to comment https://forums.phpfreaks.com/topic/219123-help-with-image-uploader/#findComment-1136424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.