Det var stien til uploads jeg havde fejl ved..
Det virker nu - så jeg siger mange tak for hjælpen!
Til folk der oplever samme problem poster jeg lige koden her:
- <form action="" method="POST" id="insert" enctype="multipart/form-data">
- <input type="file" name="photo">
- <input type="submit" name="submit" value="submit" >
- </form>
- <?php
- include('database.php'); //Connect to database
-
- $directory = dirname(__FILE__).'/uploads/'; //The folder where you want to put your pictures
- $target = $directory . basename( $_FILES['photo']['name']);
-
- //This gets all the other information from the form
- $pic=($_FILES['photo']['name']);
-
-
- //Writes the information to the database
- mysql_query("INSERT INTO `table` (row) VALUES ('$pic')") ;
-
- //Writes the photo to the server
- if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
- {
-
- //Tells you if its all ok
- echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
- }
- else {
-
- //Gives and error if its not
- echo "Sorry, there was a problem uploading your file.";
- }
- ?>
Igen - Tak for hjælpen