Re: Help with file upload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For the message:
> Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream:
> Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6

you have to change the permissions of the file folder where you are copying
the file.
If you created it via FTP then you can't use copy() or move().

check:
echo fileperms( $folder );
if it's 33188 or 33279 it's ok but I think it is not the permission of your
folder.
I think you'll get 17901 or some other.
so you have to use ftp_chmod() of ftp_site() to change it..

try this:

$folderbase = "folderbase";     // it's the folder where your folder for
uploads is.
$folder = "foldername";            // it's your folder for uploads.
$mode = "0777";

$site = ftp_connect ( "ftp.yourdomain.com" );
    if( $site != FALSE ) {

        $loged = ftp_login( $site , "your username", "your password" );

            if( $loged ) {

                ftp_chdir( $site , $folder );
                ftp_site( $site , "chmod $mode $folder" );

    }

ftp_quit( $site );


"John W. Holmes" <holmes072000@charter.net> escribió en el mensaje
3F8E1F4E.1040809@charter.net">news:3F8E1F4E.1040809@charter.net...
> Bunmi Akinmboni wrote:
>
> > Pls Help.
> > I have done a lot of reading prior to this yet I just can't seem make it
> > work. I wrote an upload program as seen below but the response I got
was:
> >
> > Possible file upload attack. Filename: ayservenet.jpg Array ( [ufile1]
> > => Array ( [name] => ayservenet.jpg [type] => image/pjpeg [tmp_name] =>
> > /tmp/phpIMEhdh [error] => 0 [size] => 3030 ) )
> [snip]
> > if (is_uploaded_file($_FILES['ufile1']['name'])) {
> >     copy($_FILES['ufile1']['name'], ".");
> >     echo "$ufile1_name ";
> >     echo "DONE";
> >     echo " ";
> >     print_r($_FILES);
> > } else {
> >     echo "Possible file upload attack. Filename: " .
> > $_FILES['ufile1']['name'];
> >     echo " ";
> >     print_r($_FILES);
> > }
> > ?>
>
> You should pass $_FILES['ufile1']['tmp_name'] to is_uploaded_file().
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals ? www.phparch.com


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux