How to mahe a simple file upload using xampp

I am trying to make a simple opload of a given file to my local server on xampp system.
This is the code:

Fil:
?php

$fil = $_FILES[“fil”];

// Kontroller om uploaden gik godt
if ($fil[“error”] > 0) {
echo "Upload faield. Errorkode: " . $fil[“error”];
} else {
echo “Oplysninger om den uploadede fil:
”;
echo "Navn: " . $fil[“name”] . “
”;
echo "Type: " . $fil[“type”] . “
”;
echo “Størrelse: " . $fil[“size”] . " bytes
”;
echo "Midlertidigt gemt i " . $fil[“tmp_name”] . “
”;

}
?>

I am never allowed to upload a file. Do I have to make some ajustments on the web server.

Well, you are almost there. You must remember that uploading a file is two parts.
First, there is the form which you have.
Next, the PHP code must move the file from the temporary storage area on the server to
your assigned folder. You do not have that code in place.

Instead of transforming your code, look at this tutorial that explains how to do it.
This site is full of thousands of tutorials on all areas of programming. It should help you.

http://www.w3schools.com/php/php_file_upload.asp

Sponsor our Newsletter | Privacy Policy | Terms of Service