--- bobsawyerdotcom <[EMAIL PROTECTED]> wrote:

> --- In [email protected], Parag Bhavsar <[EMAIL PROTECTED]> wrote:
> > check the server variable
> > $_SERVER["PATH_INFO"] varible using phpinfo and according 
> > first give hardcode path in the destfile file and then try 
> > uploading.
> 
> Hi Parag,
> 
> I actually had the hard-coded path in there to begin with (gathered
> from phpinfo()) but that didn't work either. I tried
> $_SERVER['DOCUMENT_ROOT'] after the hard-coded path didn't work...
> 
> > There is one more method to upload file by using copy 
> > instead of move_uploaded_file.
> 
> Yup, tried that, as well as rename() ... neither worked.
> 
> -Bob


When performing file uploads, an important and often overlooked characteristic
is the structure of the <form> tag.  You must have
enctype='multipart/form-data' in the tag along with the method='post' and
action properties.

If this is not correct, you won't see anything in the $_FILES array.  You
should try to display it before performing your if statement.  Here is a basic
template:

<form method='post' action='script.php' enctype='multipart/form-data'>
<input type='file' name='myfile'>
<input type='submit' value='upload'>
</form>

<?php
printf("<pre>%s</pre>", print_r($_FILES,true));
if (is_uploaded_file($_FILES['myfile']['tmp_name']))
{
 if (move_uploaded_file($_FILES['myfile']['tmp_name'], $destination_dir_name))
 {
  print "File succesfully moved.";
 }
 else
 {
  print "Failed to move file.";
 }
}
?>
_____

The other very common problem is that your web server (Apache?) running as a
non-priveleged user (apache or nobody) does not have write permission for the
destination directory.

James
_____

James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Summer Semester Begins Jun 20 -- New Classes Start Every Few Weeks.


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hjkll5l/M=362131.6882499.7825260.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1122964223/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to