Question:

HTML/PHP question. File Uploads

by  |  earlier

0 LIKES UnLike

hello. i've already created a file upload forum, im just having trouble uploading and saving files on my hard drive, im testing it on an offline website on adobe dreamweaver.

whenever i choose and upload a file it will link me directly to my php upload file (upload_file.php), shown below.....

<?php

if ((($_FILES["file"]["type"] == "image/gif")

|| ($_FILES["file"]["type"] == "image/jpeg")

|| ($_FILES["file"]["type"] == "image/pjpeg"))

&& ($_FILES["file"]["size"] < 20000))

{

if ($_FILES["file"]["error"] > 0)

{

echo "Return Code: " . $_FILES["file"]["error"] . "
";

}

else

{

echo "Upload: " . $_FILES["file"]["name"] . "
";

echo "Type: " . $_FILES["file"]["type"] . "
";

echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";

echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
"; if (file_exists("upload/" . $_FILES["file"]["name"]))

{

echo $_FILES["file"]["name"] . " already exists. ";

}

else

{

move_uploaded_file($_FILES["file"]["tmp_...

"upload/" . $_FILES["file"]["name"]);

echo "Stored in: " . "upload/" . $_FILES["file"]["name"];

}

}

}

else

{

echo "Invalid file";

}

?>

i think i need an FTP to save files onto my Macbook.

P.s How do i setup my Macbook as a Personal Server.

 Tags:

   Report

1 ANSWERS


  1. First of all I would ask the mac-book as a personal server as a separate question because its a folding question for sure!

    Secondly, i would take a look at this script as inspiration, what your doing can be simplified a lot

    http://www.webdevboost.co.uk/Programming...

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions