Does the img directory have writes permission? >>Please, >> >>Can anybody help me with my problem !!???? I'm getting crazy..... >> >>I am trying the upload a file to the server where my website is. >>I get always the same fault when I want the try this code: >>"Warning: Unable to create 'test.jpg': Permission denied in >>/lvdata/www/tennis/Contact.php on line 147" >> Line 147 is the one with: "copy($_FILES['file']['tmp_name'],"imgs/" . >>$newFileName)"; >> >>Where is my fault. Has this something to do with the password which you use >>to drop files on the particle server or... ? >> >> >> >> THIS IS MY CODE: >> >> >> if (!$_POST['submit']) >> { >> ?> >> >> <form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" >>method="post"> >> Description:<br> >> <input type="Text" name="titel" size="40"> >> <input type="Text" name="desc" size="40"> >> File:<br> >> <input type="file" name="file"> >> <input type="submit" name="submit" value="Add Image"> >> </form> >> >> <?php >> } >> else >> { >> $titel = addslashes($_POST['titel']); >> $desc = addslashes($_POST['desc']); >> >> // validate form data >> if ($_FILES['file']['size'] == 0) >> { >> die("Bad upload!"); >> } >> if ($_FILES['file']['type'] != "image/gif" && $_FILES['file']['type'] != >>"image/jpeg" && $_FILES['file']['type'] != "image/pjpeg") >> { >> die("Invalid file format!"); >> } >> if (!$_POST['desc']) >> { >> die("No description!"); >> } >> // get file type and rename file to recordID.ext >> if ($_FILES['file']['type'] == "image/gif") >> { >> $ext = ".gif"; >> } >> if ($_FILES['file']['type'] == "image/jpeg") >> { >> $ext = ".jpg"; >> } >> if ($_FILES['file']['type'] == "image/pjpeg") >> { >> $ext = ".jpg"; >> } >> >> $newFileName = 'test'. $ext; >> >> copy($_FILES['file']['tmp_name'],"imgs/" . $newFileName); >> >> }
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php