December 16, 201114 yr I have a image code but i can't seem to upload any files or get any to show. I tired to contact the person who gave me the code but he no longer exists on a site i used ages ago. The file button: <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Upload File:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> Upload_File.php <font color="red"><h3>Thankyou for uploading!</h3></font> <br /> <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 30000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "URL: " . "URL TO YOUR FILE UPLOAD FOLDER" . $_FILES["file"]["name"]; } } } else { echo "Sorry, an error occurred. Your File was a format that we do not currently host."; } ?> </div> <div class="meta"> <p class="byline"> </p> </div> </div> </div> <!-- end content --> <div style="clear: both;"> </div> </div> <!-- end page --> Ive tried to add my folder where i want the images to go but nothing appears. I want the images to upload to a folder called www.mydomain.com/images Thanks.
December 16, 201114 yr Could be this { move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); Try changing the above to the below { move_uploaded_file($_FILES["file"]["tmp_name"], "images/" . $_FILES["file"]["name"]);
Create an account or sign in to comment