Jump to content

BigheadNathan54

Members
  • Posts

    4
  • Joined

  • Last visited

BigheadNathan54's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Ok, I just figured out the problem. The permissions for my directory was set so that it would block anyone from uploading, but for some reason it said it was at 777 when its really not. I just had to go in and refresh the permission settings page. Problem solved. Thanks.
  2. Ok, I made a new PHP file (bla.php) and copied and pasted the code in it. When I ran it, I got this message:
  3. Well, I've set the PHP file, HTML file, and the 'upload' folder all to 777 permissions (no need for 775, as i'm only letting those i know i can trust that it exists), and I'm still getting the same error message. Now I haven't tried using those CHGRP or CHMOD codes yall gave me, but I don't know where to put them. Where do I put them? Sorry, I'm just now trying to learn the basics of PHP.
  4. I need a way for my users to upload certain content to my website, so I came across this code layed out for me at W3Schools (http://www.w3schools.com/php/php_file_upload.asp).Anyways, I did a test run on it and it didn't work properly. Here is what the code looks like (i just coppied and pasted) in my upload_file.php file: <?phpif (($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/pjpeg")&& ($_FILES["file"]["size"] < 20000)) { 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"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } }else { echo "Invalid file"; }?> Here is what my HTML code for it looks like (tiled uploader.html): <html><body><form action="upload_file.php" method="post"enctype="multipart/form-data"><label for="file">Filename:</label><input type="file" name="file" id="file" /> <br /><input type="submit" name="submit" value="Submit" /></form></body></html> I tried uploading a simple 7KB 88x31 .jpeg image, and instead of uploading it I got this message: I checked the areas where it said the errors were (around line 22) and I don't see what the problem is. I'm actually new to PHP coding so I really couldn't spot errors no matter what, and yes I did make the /upload directory in the same folder as those two HTML and PHP files and their is nothing in it. So, what did I miss?
×
×
  • Create New...