Re: Uploaden files to the server
| From: | Gabor Hojtsy | Date: | Tue, 11 May 2004 12:14:13 +0000 |
| Subject: | Re: Uploaden files to the server | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969360615@lists.php.net to get a copy of this message | ||
Please ask PHP related support questions at php-general@lists.php.net
This is not the right place to ask such questions.
Goba
Lieve Vissenaeken írta:
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);} ?>