>I am having the worst trouble trying to write a tiny simple script that
>will upload a file.  Below is my code - can anyone tell me why it's not
><form name="form1" method="post" action="upload.php"
>  <input type="hidden" name="MAX_FILE_SIZE" value="1000">
>  <input type="file" name="userfile">
>  <input type="submit" name="Submit" value="Submit">
>PHP (upload.php)
>$filename = "/test.txt";
>if (!move_uploaded_file($userfile, $filename))
> echo "something barfed.";
> exit;
> echo "uploaded.";
>Something is most likely wrong with the $filename variable.  I don't
>know what exactly to put in there.  All I want to do is upload a file
>and then move/copy it to a specific directory. 
>What am I doing wrong?!?!


PHP does not have the permission to write data to '/test.txt'

You'll have to change $filename to a world-writable directory.

Do *NOT* *NOT* *NOT* make it in your web-tree.

Create a new directory next to your 'htdocs' (or 'www' or 'web' or

NEXT TO that, not *inside*

mkdir newdir

Then, make that directory world-writable:

chmod 777 newdir

Then, use the full path to newdir in your $filename:

cd newdir

$filename = '/full/path/to/newdir/test.txt';'

Like Music?  http://l-i-e.com/artists.htm

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to