http://www.w3schools.com/php/php_file_upload.asp
But I am having problem with the upload process. I have placed all three pages necessary on my server. Even named a folder "upload" within the server. But when I upload and run the test the file doesn't get uploaded correctly to my server. No image is in my upload folder. What do I need to do to make it work? I
http://www.w3schools.com/php/php_file_upload.asp
It's a two to three part page code. It's located here on this link on the W3 Schools website. I would post what code I have, but I know the admins don't like it when you plain copy and paste the code. I never knew how to paste it correctly within the post.
here is the file save code I have so far.
Expand|Select|Wrap|Line Numbers
- <?php
- if ((($_FILES["file"]["type"] == "image/gif")
- || ($_FILES["file"]["type"] == "image/jpeg")
- || ($_FILES["file"]["type"] == "image/pjpeg"))
- && ($_FILES["file"]["size"] < 100000))
- {
- 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("http://www.penciledmemories.com/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: " . "http://www.penciledmemories.com/upload/" . $_FILES["file"]["name"];
- }
- }
- }
- else
- {
- echo "Invalid file";
- }
- ?>