URGENT, PLEASE HELP !!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nirma78
Forum Commoner
Posts: 42
Joined: Wed Sep 17, 2003 2:02 pm

URGENT, PLEASE HELP !!

Post by nirma78 »

I am trying to upload a file in php, but it gives me this error :

Warning: move_uploaded_file(/home/httpd/htdocs/gbcb/): failed to open stream: Is a directory in /home/httpd/htdocs/gbcb/upload_app_files.php on line 26

Warning: move_uploaded_file(): Unable to move '/tmp/phpCaJbP9' to '/home/httpd/htdocs/gbcb/' in /home/httpd/htdocs/gbcb/upload_app_files.php on line 26


below is my code for this :

the location where my file is /home/httpd/htdocs/gbcb/upload.php
I am working on windows
the server is on another machine

PLEASE HELP !!

/**********************************************************/
<?php
$transcript = $_FILES['userfile']['name'][0];
$tmp_dest = $_FILES['userfile']['tmp_name'][0];
?>

<p><?php echo "transcript value : $transcript";?> </p>
<p><?php echo "temporary destination value : $tmp_dest"; ?> </p>
<?php
$up = move_uploaded_file($_FILES['userfile']['tmp_name'][0], '/home/httpd/htdocs/gbcb/');
var_dump($up);
if($up)
{
echo "File uploaded";
}
else
{
echo "Not uploaded";
}
?>

/**********************************************************/
rterrar
Forum Newbie
Posts: 8
Joined: Wed Aug 06, 2003 12:32 am

Post by rterrar »

The second parameter has to have the filename to move to. Not just the directory.

$up = move_uploaded_file($_FILES['userfile']['tmp_name'][0], '/home/httpd/htdocs/gbcb/filename');
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Moved to PHP - Normal, it's not a database question.

Mac
nirma78
Forum Commoner
Posts: 42
Joined: Wed Sep 17, 2003 2:02 pm

Post by nirma78 »

hey rterrar !!

Thanks for your help.

It worked !!
Post Reply