|
Posted by Erwin Moller on 11/16/07 09:10
Andy2500 wrote:
> Sorry that I use the new post because when I replied in the old one,
> nothing display !
>
>
>> so php is running fine, indicating that php initiated by a web hit
>> does in fact have permissions to read/parse .php files.
>
>> post the errors back here please. ......., we'll need to look at a
>> couple of other things more closely.
>
>
> here is the code of the simplest example with its errors :
>
> ==========================================================
>
> <?php
>
> if( isset($_POST['upload']) )
> {
> $content_dir = 'upload/'; // folder that file will move into
>
> $tmp_file = $_FILES['fichier']['tmp_name'];
>
> if( !is_uploaded_file($tmp_file) )
> {
> exit("file is inaccessible");
> }
>
> // copy the file into the folder
> $name_file = $_FILES['fichier']['name'];
Hi,
Never trust your own code. ;-)
In case of problems: output what you are doing.
So add here:
echo "\$tmp_file=$tmp_file<hr>";
$target = $content_dir . $name_file;
echo "\$target=$target<hr>";
What output does that give?
Do you recognize the directories?
Is the targetdirectory writable by PHP?
Regards,
Erwin Moller
>
> if( !move_uploaded_file($tmp_file, $content_dir . $name_file) )
> {
> exit("Impossible copy into the folder $content_dir");
> }
> echo "file is uploaded";
> }
>
> ?>
>
> <form method="post" enctype="multipart/form-data" action="simple.php">
> <p>
> <input type="file" name="fichier" size="30">
> <input type="submit" name="upload" value="Uploader">
> </p>
> </form>
>
> -------------------------------------------------------
>
> the errors are :
>
> Warning: move_uploaded_file(upload/Guitarre.jpg) [function.move-uploaded-
>
> file]: failed to open stream: Permission denied in
>
> C:\Inetpub\wwwroot\simple.php on line 20
>
> Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move
>
> 'C:\WINNT\TEMP\php106.tmp' to 'upload/Guitarre.jpg' in
>
> C:\Inetpub\wwwroot\simple.php on line 20
>
> Impossible copy into the folder upload/
>
>
> --------------------------------------------------------
>
> PS: WinXP Pro SP2, IIS 5.1 , PHP 5.1.2
>
> It will be highly appreciated that you can test this code and
> see if the same errors appear.
>
>
>
Navigation:
[Reply to this message]
|