Ok, hi. I found an upload script on the internet and I'm having a couple small issues with it that Look simple to resolve. I just don't know how.

I keep getting the following error:

Warning: open_basedir restriction in effect. 
File is in wrong directory in XXXXX/xxxxxx/XXXXXXXX/xxxxxxx
/xxx.x.x.xxx/upload/do-upload.php on line 10
File could not be uploaded 

So, it must have something to do with the path.

Here's the code.
This file, do-upload.php is in the uploads dir.

<HTML><HEAD> 
<TITLE>Uploading your file</TITLE> 
</HEAD> 
<BODY> 
<P><FONT size="4"> 

<?php 
$Path = ""; 

if(copy($_FILES['upload-file']['tmp_name'], $Path.'/'.$_FILES['upload-file']['name'])){

echo 'File Uploaded Successfully';

}else{

echo 'File could not be uploaded';

} 

?>

</FONT></P> 
</BODY> 
</HTML> 

like I said. Simple. What should path be?

    a lot of hosts require the full path to the folder where you want the file to reside

    so if you have doupload.php uploading to a folder down a level called files, then make path

    $path = "full/path/to/directory/files";

    where doupload.php is in the directory called directory

    make sense?

      sort of. According to my host, the full would be.

      /xxxr/XXXX/xxxx/hxxx/xxxx/xyzxyz.com/htdocs/youth.curtisbaptist.org/workstation/upload/uploads

      I've tried that. And it doesn't work. And I've tried just "youth.curtisbaptist.org/workstation/upload/uploads" too and I've tried "/uploads" and "" I still get the error.

        don't use the [url]http://[/url] path, use the servers path...

        like /var/www/html/directory/files or whatever it is

          I know. Hence the /xxxr/XXXX/xxxx/hxxx/xxxx/xyzxyz.com/htdocs/youth.curtisbaptist.org/workstation/upload/uploads (see above). It doesn't change a thing! I just said that (the [url]http://[/url]) because I thought It might have helped it the diagnoses of the problem.

            Do you have the proper permissions on the folder you are trying to write to?

            You need at least rw permissions for PHP to be able to write to the folder.

              Amazing!!!!!!!!!!!!!
              Your the coolest!!

              Somehow when I re-intered $path as the full path and then sent re-chmodded it worked!!!

              //Hobbit does happy dance

                Originally posted by Black Hobbit
                Amazing!!!!!!!!!!!!!
                Your the coolest!!

                Somehow when I re-intered $path as the full path and then sent re-chmodded it worked!!!

                //Hobbit does happy dance

                see, it was just a matter of fumbling with different stuff, now you'll never forget this when you have problems with this again...

                unless you are forgetful like me, then you just need a slap in the forehead to refresh yourself

                glad i could help

                  Write a Reply...