Posted by Mark ??;-\) on 08/25/05 05:06
If I understand this correctly (fairly new to PHP myself), $File is not
defined anywhere. That is why it is false. Look here for information on
uploading files
http://us2.php.net/manual/en/features.file-upload.php#features.file-upload.post-method
Basically you want to use the $_Files Super Global variables.
Try something like:
if (is_uploaded_file($_Files['userfile']['tmp_name']){
print "File Name " . $_Files['userfile']['name'] . "\n";
print "File Size " . $_Files['userfile']['size'] . "\n";
move_uploaded_file(........etc.
Hope that helps.
-Mark
"Rivera" <boosh@pacbell.net> wrote in message
news:lw6Pe.620$sV7.45@newssvr21.news.prodigy.com...
> Can anyone tell me why this doesn't work it seems simple enough.
> The if($File) is always false and i dont understand why.
>
> file name is index2.php
> <html>
> <body>
> <?PHP
> if($File)
> {
> print ("File Name " . $File_name . "\n");
> print ("File Name " . $File_size . "\n");
> if(Copy($File,$File)){
> print "Uploaded\n";
> unlink($File);
> }
> else print "Cannot Upload file " . $File_name;
> }
>
>
> print("<form action=index2.php method=POST enctype=multipart/form-data>
> <p>Pictures:
> <input type=File name=File />
> <input type=submit value=Send />
> </p>
> </form>");
>
>
> ?>
> </body>
> </html>
>
>
> Thanks a lot!
>
>
[Back to original message]
|