Dette er min form
- <form action="process.php?DO=useravatar" method="POST" enctype="multipart/form-data">
- Upload et billede:<br />
- <input type="file" name="file" id="file" /><br />
- <input type="submit" name="submit" value="Gem" />
- </form>
Og min PHP
- echo "Fil: " . $_FILES["file"]["name"] . "<br />";
-
- $rand = rand( 100 , 20000);
- $base = "/home/borgens1/www/";
- $dir = "/uploads/";
- $filename = $_FILES["file"]["name"]."_".$rand."_".$_FILES["file"]["name"];
-
- $file = $base.$dir.$filename;
-
- move_uploaded_file($_FILES["file"]["name"] , $file);
- chmod($file , 0755);