473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Chmod

Hi,

I am at the base of an FTP thingy i'm building, and i noticed that
it would only work if i chmod the folder 777, i thought to remember
correctly that previously on another site chmod 744 was enough,
now it isn't.
Am i mistaking, and should it always be 777 ? And isn't a chmodded
777 folder much more vulnerable?

Frizzle.
Code sofar below:
++++++++++++++++++++++++++
<?php

require_once('../inc/globals.php');

if( isset( $_FILES['image'] ) ){

$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b>');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<bError!</b>');

$uploaddir = '../items/';
$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );

if ( move_uploaded_file( $_FILES['image']['tmp_name'], $uploadfile ) ){
echo "File is valid, and was successfully uploaded.";
} else {
echo "Possible file upload attack!";
};

ftp_close( $ftp_conn );

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="image" type="file" id="image">
<br>
<input type="submit" name="upload" id="upload" value="Upload">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:history.go(-1) ">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file :
filetype: " . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>
----------------------------------------------------

Apr 4 '06 #1
47 3259

Gary L. Burnore wrote:
On 4 Apr 2006 15:10:39 -0700, "frizzle" <ph********@gmail.com> wrote:
Hi,

I am at the base of an FTP thingy i'm building, and i noticed that
it would only work if i chmod the folder 777, i thought to remember
correctly that previously on another site chmod 744 was enough,
now it isn't.
Am i mistaking, and should it always be 777 ? And isn't a chmodded
777 folder much more vulnerable?

Most definitely more vulnerable.
You want 755, not 744. You need the x bit set. It should look like
this:

drwxr-xr-x ... ...
The x on a directory means search, not execute. If you can't search
the directory, you can't read the files in it.

If you want people to be able to find the files but not list the
directory when they're on the server, you can set the directory as 711
which would look like:

drwx--x--x ... ...
Frizzle.
Code sofar below:
++++++++++++++++++++++++++
<?php

require_once('../inc/globals.php');

if( isset( $_FILES['image'] ) ){

$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b>');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<bError!</b>');

$uploaddir = '../items/';
$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );

if ( move_uploaded_file( $_FILES['image']['tmp_name'], $uploadfile ) ){
echo "File is valid, and was successfully uploaded.";
} else {
echo "Possible file upload attack!";
};

ftp_close( $ftp_conn );

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="image" type="file" id="image">
<br>
<input type="submit" name="upload" id="upload" value="Upload">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:history.go(-1) ">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file:
filetype: " . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>
----------------------------------------------------

--
gburnore at DataBasix dot Com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ 0 1 7 2 3 / Ý³Þ 3 74 9 3 0 Û³
Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
================================================== =========================


Hmm, i still get an error; i chmodded both the destination folder AND
the executing script-file 755.

Warning: move_uploaded_file(../items/bg.jpg): failed to open stream:
Permission denied in
/home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15

Read mode Write mode Execute/search mode
Owner + + +
Group + - +
Others + - +

Frizzle.

Apr 4 '06 #2
Are you allowing your web server write permissions to the folder?
Assuming the webserver runs as 'nobody' .
755 with ownership nobody, nobody . Otherwise you'll need
775 with ownership frizzle, nobody
frizzle wrote:
Gary L. Burnore wrote:
On 4 Apr 2006 15:10:39 -0700, "frizzle" <ph********@gmail.com> wrote:
Hi,

I am at the base of an FTP thingy i'm building, and i noticed that
it would only work if i chmod the folder 777, i thought to remember
correctly that previously on another site chmod 744 was enough,
now it isn't.
Am i mistaking, and should it always be 777 ? And isn't a chmodded
777 folder much more vulnerable?

Most definitely more vulnerable.
You want 755, not 744. You need the x bit set. It should look like
this:

drwxr-xr-x ... ...
The x on a directory means search, not execute. If you can't search
the directory, you can't read the files in it.

If you want people to be able to find the files but not list the
directory when they're on the server, you can set the directory as 711
which would look like:

drwx--x--x ... ...
Frizzle.
Code sofar below:
++++++++++++++++++++++++++
<?php

require_once('../inc/globals.php');

if( isset( $_FILES['image'] ) ){

$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b>');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<bError!</b>');

$uploaddir = '../items/';
$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );

if ( move_uploaded_file( $_FILES['image']['tmp_name'], $uploadfile ) ){
echo "File is valid, and was successfully uploaded.";
} else {
echo "Possible file upload attack!";
};

ftp_close( $ftp_conn );

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="image" type="file" id="image">
<br>
<input type="submit" name="upload" id="upload" value="Upload">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:history.go(-1) ">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file :
filetype: " . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>
----------------------------------------------------

--
gburnore at DataBasix dot Com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ 0 1 7 2 3 / Ý³Þ 37 4 9 3 0 Û³
Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
================================================== =========================


Hmm, i still get an error; i chmodded both the destination folder AND
the executing script-file 755.

Warning: move_uploaded_file(../items/bg.jpg): failed to open stream:
Permission denied in
/home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15

Read mode Write mode Execute/search mode
Owner + + +
Group + - +
Others + - +

Frizzle.


Apr 5 '06 #3

bobzimuta wrote:
Are you allowing your web server write permissions to the folder?
Assuming the webserver runs as 'nobody' .
755 with ownership nobody, nobody . Otherwise you'll need
775 with ownership frizzle, nobody
frizzle wrote:
Gary L. Burnore wrote:
On 4 Apr 2006 15:10:39 -0700, "frizzle" <ph********@gmail.com> wrote:

>Hi,
>
>I am at the base of an FTP thingy i'm building, and i noticed that
>it would only work if i chmod the folder 777, i thought to remember
>correctly that previously on another site chmod 744 was enough,
>now it isn't.
>Am i mistaking, and should it always be 777 ? And isn't a chmodded
>777 folder much more vulnerable?
Most definitely more vulnerable.
You want 755, not 744. You need the x bit set. It should look like
this:

drwxr-xr-x ... ...
The x on a directory means search, not execute. If you can't search
the directory, you can't read the files in it.

If you want people to be able to find the files but not list the
directory when they're on the server, you can set the directory as 711
which would look like:

drwx--x--x ... ...

>Frizzle.
>
>
>Code sofar below:
>
>
>++++++++++++++++++++++++++
><?php
>
> require_once('../inc/globals.php');
>
> if( isset( $_FILES['image'] ) ){
>
>$ftp_conn = @ftp_connect( $default_ftp_server )or
>die('<b>Error!</b>');
>@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
>die('<bError!</b>');
>
>$uploaddir = '../items/';
>$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
>
>if ( move_uploaded_file( $_FILES['image']['tmp_name'], $uploadfile )){
> echo "File is valid, and was successfully uploaded.";
>} else {
> echo "Possible file upload attack!";
>};
>
>ftp_close( $ftp_conn );
>
>};
>
>?>
><form action="<?php echo $PHP_SELF; ?>" method="post"
>enctype="multipart/form-data" name="images" target="_top" id="images"
>class="form">
> <input name="image" type="file" id="image">
> <br>
> <input type="submit" name="upload" id="upload" value="Upload">
> <input name="cancel" type="button" id="cancel" value="Cancel"
>onClick="javascript:history.go(-1) ">
></form><?php
>
> if (is_dir($uploaddir)) {
> if ($dh = opendir($uploaddir)) {
> while (($file = readdir($dh)) !== false) {
> if ($file !== '..' && $file !== '.') echo "filename: $file :
>filetype: " . filetype($uploaddir . $file) . "<br>\r\n";
> }
> closedir($dh);
> }
> };
>
>?>
>----------------------------------------------------
--
gburnore at DataBasix dot Com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ 0 1 7 2 3 / ݳÞ3 7 4 9 3 0 Û³
Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
================================================== =========================


Hmm, i still get an error; i chmodded both the destination folder AND
the executing script-file 755.

Warning: move_uploaded_file(../items/bg.jpg): failed to open stream:
Permission denied in
/home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15

Read mode Write mode Execute/search mode
Owner + + +
Group + - +
Others + - +

Frizzle.


Standard (DW created files/dirs) have user 'domainname', permissions
'rwx r-x r-x ',
Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
--- --- '

Frizzle.

Apr 5 '06 #4

frizzle wrote:
bobzimuta wrote:
Are you allowing your web server write permissions to the folder?
Assuming the webserver runs as 'nobody' .
755 with ownership nobody, nobody . Otherwise you'll need
775 with ownership frizzle, nobody
frizzle wrote:
Gary L. Burnore wrote:
> On 4 Apr 2006 15:10:39 -0700, "frizzle" <ph********@gmail.com> wrote:
>
> >Hi,
> >
> >I am at the base of an FTP thingy i'm building, and i noticed that
> >it would only work if i chmod the folder 777, i thought to remember
> >correctly that previously on another site chmod 744 was enough,
> >now it isn't.
> >Am i mistaking, and should it always be 777 ? And isn't a chmodded
> >777 folder much more vulnerable?
>
>
> Most definitely more vulnerable.
>
>
> You want 755, not 744. You need the x bit set. It should look like
> this:
>
> drwxr-xr-x ... ...
>
>
> The x on a directory means search, not execute. If you can't search
> the directory, you can't read the files in it.
>
> If you want people to be able to find the files but not list the
> directory when they're on the server, you can set the directory as 711
> which would look like:
>
> drwx--x--x ... ...
>
>
>
> >Frizzle.
> >
> >
> >Code sofar below:
> >
> >
> >++++++++++++++++++++++++++
> ><?php
> >
> > require_once('../inc/globals.php');
> >
> > if( isset( $_FILES['image'] ) ){
> >
> >$ftp_conn = @ftp_connect( $default_ftp_server )or
> >die('<b>Error!</b>');
> >@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
> >die('<bError!</b>');
> >
> >$uploaddir = '../items/';
> >$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
> >
> >if ( move_uploaded_file( $_FILES['image']['tmp_name'], $uploadfile) ){
> > echo "File is valid, and was successfully uploaded.";
> >} else {
> > echo "Possible file upload attack!";
> >};
> >
> >ftp_close( $ftp_conn );
> >
> >};
> >
> >?>
> ><form action="<?php echo $PHP_SELF; ?>" method="post"
> >enctype="multipart/form-data" name="images" target="_top" id="images"
> >class="form">
> > <input name="image" type="file" id="image">
> > <br>
> > <input type="submit" name="upload" id="upload" value="Upload">
> > <input name="cancel" type="button" id="cancel" value="Cancel"
> >onClick="javascript:history.go(-1) ">
> ></form><?php
> >
> > if (is_dir($uploaddir)) {
> > if ($dh = opendir($uploaddir)) {
> > while (($file = readdir($dh)) !== false) {
> > if ($file !== '..' && $file !== '.') echo "filename:$file :
> >filetype: " . filetype($uploaddir . $file) . "<br>\r\n";
> > }
> > closedir($dh);
> > }
> > };
> >
> >?>
> >----------------------------------------------------
> --
> gburnore at DataBasix dot Com
> ---------------------------------------------------------------------------
> How you look depends on where you go.
> ---------------------------------------------------------------------------
> Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
> | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
> Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
> | ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
> Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
> ================================================== =========================

Hmm, i still get an error; i chmodded both the destination folder AND
the executing script-file 755.

Warning: move_uploaded_file(../items/bg.jpg): failed to open stream:
Permission denied in
/home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15

Read mode Write mode Execute/search mode
Owner + + +
Group + - +
Others + - +

Frizzle.


Standard (DW created files/dirs) have user 'domainname', permissions
'rwx r-x r-x ',
Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
--- --- '

Frizzle.


Is there a possibility to upload files via PHP without Chmodding, and
keep the same group / permissions on uploaded files as those uploaded
with, say, DreamWeaver or WS_FTP ?

Frizzle.

(E.g. with ftp_put() wich i can't seem to get working.)

Apr 5 '06 #5
I have a semi related chmod question that i think i know the answer too
alredy but just want to be sure...

Is it possible using PHP to set the permissions on a folder created from
within a php application...
"frizzle" <ph********@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi,

I am at the base of an FTP thingy i'm building, and i noticed that
it would only work if i chmod the folder 777, i thought to remember
correctly that previously on another site chmod 744 was enough,
now it isn't.
Am i mistaking, and should it always be 777 ? And isn't a chmodded
777 folder much more vulnerable?

Frizzle.
Code sofar below:
++++++++++++++++++++++++++
<?php

require_once('../inc/globals.php');

if( isset( $_FILES['image'] ) ){

$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b>');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<bError!</b>');

$uploaddir = '../items/';
$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );

if ( move_uploaded_file( $_FILES['image']['tmp_name'], $uploadfile ) ){
echo "File is valid, and was successfully uploaded.";
} else {
echo "Possible file upload attack!";
};

ftp_close( $ftp_conn );

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="image" type="file" id="image">
<br>
<input type="submit" name="upload" id="upload" value="Upload">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:history.go(-1) ">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file :
filetype: " . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>
----------------------------------------------------

Apr 5 '06 #6
frizzle wrote:
frizzle wrote:
bobzimuta wrote:
Are you allowing your web server write permissions to the folder?
Assuming the webserver runs as 'nobody' .
755 with ownership nobody, nobody . Otherwise you'll need
775 with ownership frizzle, nobody
frizzle wrote:

Gary L. Burnore wrote:

>On 4 Apr 2006 15:10:39 -0700, "frizzle" <ph********@gmail.com> wrote:
>
>
>>Hi,
>>
>>I am at the base of an FTP thingy i'm building, and i noticed that
>>it would only work if i chmod the folder 777, i thought to remember
>>correctly that previously on another site chmod 744 was enough,
>>now it isn't.
>>Am i mistaking, and should it always be 777 ? And isn't a chmodded
>>777 folder much more vulnerable?
>
>
>Most definitely more vulnerable.
>
>
>You want 755, not 744. You need the x bit set. It should look like
>this:
>
>drwxr-xr-x ... ...
>
>
>The x on a directory means search, not execute. If you can't search
>the directory, you can't read the files in it.
>
>If you want people to be able to find the files but not list the
>directory when they're on the server, you can set the directory as 711
>which would look like:
>
>drwx--x--x ... ...
>
>
>
>
>>Frizzle.
>>
>>
>>Code sofar below:
>>
>>
>>++++++++++++++++++++++++++
>><?php
>>
>> require_once('../inc/globals.php');
>>
>> if( isset( $_FILES['image'] ) ){
>>
>>$ftp_conn = @ftp_connect( $default_ftp_server )or
>>die('<b>Error!</b>');
>>@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
>>die('<bError!</b>');
>>
>>$uploaddir = '../items/';
>>$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
>>
>>if ( move_uploaded_file( $_FILES['image']['tmp_name'], $uploadfile ) ){
>> echo "File is valid, and was successfully uploaded.";
>>} else {
>> echo "Possible file upload attack!";
>>};
>>
>>ftp_close( $ftp_conn );
>>
>>};
>>
>>?>
>><form action="<?php echo $PHP_SELF; ?>" method="post"
>>enctype="multipart/form-data" name="images" target="_top" id="images"
>>class="form">
>> <input name="image" type="file" id="image">
>> <br>
>> <input type="submit" name="upload" id="upload" value="Upload">
>> <input name="cancel" type="button" id="cancel" value="Cancel"
>>onClick="javascript:history.go(-1) ">
>></form><?php
>>
>> if (is_dir($uploaddir)) {
>> if ($dh = opendir($uploaddir)) {
>> while (($file = readdir($dh)) !== false) {
>> if ($file !== '..' && $file !== '.') echo "filename: $file :
>>filetype: " . filetype($uploaddir . $file) . "<br>\r\n";
>> }
>> closedir($dh);
>> }
>> };
>>
>>?>
>>----------------------------------------------------
>
>--
>gburnore at DataBasix dot Com
>---------------------------------------------------------------------------
> How you look depends on where you go.
>---------------------------------------------------------------------------
>Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
> | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
>Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
> | ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
>Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
>============================================= ==============================

Hmm, i still get an error; i chmodded both the destination folder AND
the executing script-file 755.

Warning: move_uploaded_file(../items/bg.jpg): failed to open stream:
Permission denied in
/home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15

Read mode Write mode Execute/search mode
Owner + + +
Group + - +
Others + - +

Frizzle.


Standard (DW created files/dirs) have user 'domainname', permissions
'rwx r-x r-x ',
Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
--- --- '

Frizzle.

Is there a possibility to upload files via PHP without Chmodding, and
keep the same group / permissions on uploaded files as those uploaded
with, say, DreamWeaver or WS_FTP ?

Frizzle.

(E.g. with ftp_put() wich i can't seem to get working.)


Only if you can ftp in as the web server.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 5 '06 #7
Chris H wrote:
I have a semi related chmod question that i think i know the answer too
alredy but just want to be sure...

Is it possible using PHP to set the permissions on a folder created from
within a php application...


Depends on your hosting company. If they allow it, yes.

If the php application created it, the owner will be the user running the
application - in the case of a web application, it would be the webserver's
userid. So the application would be able to chmod the directory.

However, if the directory is created by ftp (as another user), no, you won't be
able to chmod the directory - at least not without going through a lot of hoops.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 5 '06 #8
Gary L. Burnore wrote:
On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
<js*******@attglobal.net> wrote:
.
Standard (DW created files/dirs) have user 'domainname', permissions
'rwx r-x r-x ',
Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
--- --- '

Frizzle.
Is there a possibility to upload files via PHP without Chmodding, and
keep the same group / permissions on uploaded files as those uploaded
with, say, DreamWeaver or WS_FTP ?

Frizzle.

(E.g. with ftp_put() wich i can't seem to get working.)


Only if you can ftp in as the web server.

It depends on the ftp server, actually. Our ftp server correctly sets
the permissions for you when you push. Seems your ISP has something
set incorrectly.


No, he was asking how to upload files with PHP - not with FTP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 5 '06 #9

Jerry Stuckle wrote:
Gary L. Burnore wrote:
On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
<js*******@attglobal.net> wrote:
.
>Standard (DW created files/dirs) have user 'domainname', permissions
>'rwx r-x r-x ',
>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>--- --- '
>
>Frizzle.
Is there a possibility to upload files via PHP without Chmodding, and
keep the same group / permissions on uploaded files as those uploaded
with, say, DreamWeaver or WS_FTP ?

Frizzle.

(E.g. with ftp_put() wich i can't seem to get working.)
Only if you can ftp in as the web server.

It depends on the ftp server, actually. Our ftp server correctly sets
the permissions for you when you push. Seems your ISP has something
set incorrectly.


No, he was asking how to upload files with PHP - not with FTP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
chmodding etc.
So i could mail a zipfile to a client, tell them to unpack it and
upload it, and
have the upload script up and running ... ?

Frizzle.

Apr 5 '06 #10
frizzle wrote:
Jerry Stuckle wrote:
Gary L. Burnore wrote:
On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
<js*******@attglobal.net> wrote:
.
>>Standard (DW created files/dirs) have user 'domainname', permissions
>>'rwx r-x r-x ',
>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>--- --- '
>>
>>Frizzle.
>
>
>Is there a possibility to upload files via PHP without Chmodding, and
>keep the same group / permissions on uploaded files as those uploaded
>with, say, DreamWeaver or WS_FTP ?
>
>Frizzle.
>
>(E.g. with ftp_put() wich i can't seem to get working.)
>

Only if you can ftp in as the web server.
It depends on the ftp server, actually. Our ftp server correctly sets
the permissions for you when you push. Seems your ISP has something
set incorrectly.


No, he was asking how to upload files with PHP - not with FTP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
chmodding etc.
So i could mail a zipfile to a client, tell them to unpack it and
upload it, and
have the upload script up and running ... ?

Frizzle.


Frizzle,

No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
web server are.

When you ftp a file to the server, the owner of the file is the userid who
uploaded the file (signed into ftp). But when you upload via PHP, you're using
the web server, and the owner is the userid of the server itself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 6 '06 #11

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
Gary L. Burnore wrote:

On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
<js*******@attglobal.net> wrote:
.
>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>'rwx r-x r-x ',
>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>--- --- '
>>>Frizzle.
>>
>>
>>Is there a possibility to upload files via PHP without Chmodding, and
>>keep the same group / permissions on uploaded files as those uploaded
>>with, say, DreamWeaver or WS_FTP ?
>>
>>Frizzle.
>>
>>(E.g. with ftp_put() wich i can't seem to get working.)
>>
>
>Only if you can ftp in as the web server.
It depends on the ftp server, actually. Our ftp server correctly sets
the permissions for you when you push. Seems your ISP has something
set incorrectly.
No, he was asking how to upload files with PHP - not with FTP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
chmodding etc.
So i could mail a zipfile to a client, tell them to unpack it and
upload it, and
have the upload script up and running ... ?

Frizzle.


Frizzle,

No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
web server are.

When you ftp a file to the server, the owner of the file is the userid who
uploaded the file (signed into ftp). But when you upload via PHP, you're using
the web server, and the owner is the userid of the server itself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Ok, thanks.
Not to go on and on about this, but the other thing i asked is
impossible as well then?

"So i could mail a zipfile to a client, tell them to unpack it and
upload it,
and have the upload script up and running ... ?"

Frizzle.

Apr 6 '06 #12
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
Gary L. Burnore wrote:
>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
><js*******@attglobal.net> wrote:
>.
>
>
>
>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>'rwx r-x r-x ',
>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>--- --- '
>>>>
>>Frizzle.
>>>
>>>
>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>keep the same group / permissions on uploaded files as those uploaded
>>>with, say, DreamWeaver or WS_FTP ?
>>>
>>>Frizzle.
>>>
>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>
>>
>>Only if you can ftp in as the web server.
>
>
>It depends on the ftp server, actually. Our ftp server correctly sets
>the permissions for you when you push. Seems your ISP has something
>set incorrectly.
>

No, he was asking how to upload files with PHP - not with FTP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
chmodding etc.
So i could mail a zipfile to a client, tell them to unpack it and
upload it, and
have the upload script up and running ... ?

Frizzle.


Frizzle,

No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
web server are.

When you ftp a file to the server, the owner of the file is the userid who
uploaded the file (signed into ftp). But when you upload via PHP, you're using
the web server, and the owner is the userid of the server itself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Ok, thanks.
Not to go on and on about this, but the other thing i asked is
impossible as well then?

"So i could mail a zipfile to a client, tell them to unpack it and
upload it,
and have the upload script up and running ... ?"

Frizzle.


It's easy to ftp or to upload via PHP. Both work quite well (unless the
server's configuration is screwed up). It's when you try to mix the two you
start running into permission problems and need to chmod.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 6 '06 #13

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>Gary L. Burnore wrote:
>
>
>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>><js*******@attglobal.net> wrote:
>>.
>>
>>
>>
>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>'rwx r-x r-x ',
>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>--- --- '
>>>>>


>>>>>Frizzle.
>>>>
>>>>
>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>with, say, DreamWeaver or WS_FTP ?
>>>>
>>>>Frizzle.
>>>>
>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>
>>>
>>>Only if you can ftp in as the web server.
>>
>>
>>It depends on the ftp server, actually. Our ftp server correctly sets
>>the permissions for you when you push. Seems your ISP has something
>>set incorrectly.
>>
>
>No, he was asking how to upload files with PHP - not with FTP.
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
chmodding etc.
So i could mail a zipfile to a client, tell them to unpack it and
upload it, and
have the upload script up and running ... ?

Frizzle.
Frizzle,

No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
web server are.

When you ftp a file to the server, the owner of the file is the userid who
uploaded the file (signed into ftp). But when you upload via PHP, you're using
the web server, and the owner is the userid of the server itself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Ok, thanks.
Not to go on and on about this, but the other thing i asked is
impossible as well then?

"So i could mail a zipfile to a client, tell them to unpack it and
upload it,
and have the upload script up and running ... ?"

Frizzle.


It's easy to ftp or to upload via PHP. Both work quite well (unless the
server's configuration is screwed up). It's when you try to mix the two you
start running into permission problems and need to chmod.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


owkaaaaayyyy, i never realized ftp and uploading aren't the same
thing...
I don't need to mix them, i need a script to upload files, wich can
prefferably
run without any chmodding etc.

Frizzle.

Apr 6 '06 #14
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>Gary L. Burnore wrote:
>>
>>
>>
>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>><js*******@attglobal.net> wrote:
>>>.
>>>
>>>
>>>
>>>
>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>'rwx r-x r-x ',
>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>--- --- '
>>>>>>
>>>>>>Frizzle.
>>>>>
>>>>>
>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>
>>>>>Frizzle.
>>>>>
>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>
>>>>
>>>>Only if you can ftp in as the web server.
>>>
>>>
>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>the permissions for you when you push. Seems your ISP has something
>>>set incorrectly.
>>>
>>
>>No, he was asking how to upload files with PHP - not with FTP.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>chmodding etc.
>So i could mail a zipfile to a client, tell them to unpack it and
>upload it, and
>have the upload script up and running ... ?
>
>Frizzle.
>

Frizzle,

No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
web server are.

When you ftp a file to the server, the owner of the file is the userid who
uploaded the file (signed into ftp). But when you upload via PHP, you're using
the web server, and the owner is the userid of the server itself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Ok, thanks.
Not to go on and on about this, but the other thing i asked is
impossible as well then?

"So i could mail a zipfile to a client, tell them to unpack it and
upload it,
and have the upload script up and running ... ?"

Frizzle.


It's easy to ftp or to upload via PHP. Both work quite well (unless the
server's configuration is screwed up). It's when you try to mix the two you
start running into permission problems and need to chmod.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

owkaaaaayyyy, i never realized ftp and uploading aren't the same
thing...
I don't need to mix them, i need a script to upload files, wich can
prefferably
run without any chmodding etc.

Frizzle.


Ok, you just need to ensure you have the original directory permissions set
properly, then. In a typical installation the directory would be owned by the
webserver's userid with permissions of 755.

And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
command. In either case the file ends up on the server. But how it gets there
is much different.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 6 '06 #15

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>Jerry Stuckle wrote:
>>
>>
>>
>>>Gary L. Burnore wrote:
>>>
>>>
>>>
>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>><js*******@attglobal.net> wrote:
>>>>.
>>>>
>>>>
>>>>
>>>>
>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>'rwx r-x r-x ',
>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>--- --- '
>>>>>>>
>>>>>>>Frizzle.
>>>>>>
>>>>>>
>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>
>>>>>>Frizzle.
>>>>>>
>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>
>>>>>
>>>>>Only if you can ftp in as the web server.
>>>>
>>>>
>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>the permissions for you when you push. Seems your ISP has something
>>>>set incorrectly.
>>>>
>>>
>>>No, he was asking how to upload files with PHP - not with FTP.
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>chmodding etc.
>>So i could mail a zipfile to a client, tell them to unpack it and
>>upload it, and
>>have the upload script up and running ... ?
>>
>>Frizzle.
>>
>
>Frizzle,
>
>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>web server are.
>
>When you ftp a file to the server, the owner of the file is the userid who
>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>the web server, and the owner is the userid of the server itself.
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
Ok, thanks.
Not to go on and on about this, but the other thing i asked is
impossible as well then?

"So i could mail a zipfile to a client, tell them to unpack it and
upload it,
and have the upload script up and running ... ?"

Frizzle.
It's easy to ftp or to upload via PHP. Both work quite well (unless the
server's configuration is screwed up). It's when you try to mix the two you
start running into permission problems and need to chmod.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

owkaaaaayyyy, i never realized ftp and uploading aren't the same
thing...
I don't need to mix them, i need a script to upload files, wich can
prefferably
run without any chmodding etc.

Frizzle.


Ok, you just need to ensure you have the original directory permissions set
properly, then. In a typical installation the directory would be owned by the
webserver's userid with permissions of 755.

And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
command. In either case the file ends up on the server. But how it gets there
is much different.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
folders are standard chmodded 755.
That should be allright then ...

Frizzle.

Apr 6 '06 #16
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>frizzle wrote:
>>
>>
>>
>>>Jerry Stuckle wrote:
>>>
>>>
>>>
>>>
>>>>Gary L. Burnore wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>><js*******@attglobal.net> wrote:
>>>>>.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>'rwx r-x r-x ',
>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>--- --- '
>>>>>>>>
>
>
>>>>>>>>Frizzle.
>>>>>>>
>>>>>>>
>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>
>>>>>>>Frizzle.
>>>>>>>
>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>
>>>>>>
>>>>>>Only if you can ftp in as the web server.
>>>>>
>>>>>
>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>set incorrectly.
>>>>>
>>>>
>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>
>>>>--
>>>>==================
>>>>Remove the "x" from my email address
>>>>Jerry Stuckle
>>>>JDS Computer Training Corp.
>>>>js*******@attglobal.net
>>>>==================
>>>
>>>
>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>chmodding etc.
>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>upload it, and
>>>have the upload script up and running ... ?
>>>
>>>Frizzle.
>>>
>>
>>Frizzle,
>>
>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>web server are.
>>
>>When you ftp a file to the server, the owner of the file is the userid who
>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>the web server, and the owner is the userid of the server itself.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>Ok, thanks.
>Not to go on and on about this, but the other thing i asked is
>impossible as well then?
>
> "So i could mail a zipfile to a client, tell them to unpack it and
>upload it,
> and have the upload script up and running ... ?"
>
>Frizzle.
>

It's easy to ftp or to upload via PHP. Both work quite well (unless the
server's configuration is screwed up). It's when you try to mix the two you
start running into permission problems and need to chmod.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
owkaaaaayyyy, i never realized ftp and uploading aren't the same
thing...
I don't need to mix them, i need a script to upload files, wich can
prefferably
run without any chmodding etc.

Frizzle.


Ok, you just need to ensure you have the original directory permissions set
properly, then. In a typical installation the directory would be owned by the
webserver's userid with permissions of 755.

And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
command. In either case the file ends up on the server. But how it gets there
is much different.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
folders are standard chmodded 755.
That should be allright then ...

Frizzle.


*Should be* is the key. If your host has things set ip properly, then yes you
should be OK. But if not...

And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
transfer files. I suspect Plesk does, also.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 7 '06 #17

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>Jerry Stuckle wrote:
>>
>>
>>
>>>frizzle wrote:
>>>
>>>
>>>
>>>>Jerry Stuckle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Gary L. Burnore wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>><js*******@attglobal.net> wrote:
>>>>>>.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>--- --- '
>>>>>>>>>
>>
>>
>>>>>>>>>Frizzle.
>>>>>>>>
>>>>>>>>
>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>
>>>>>>>>Frizzle.
>>>>>>>>
>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>
>>>>>>>
>>>>>>>Only if you can ftp in as the web server.
>>>>>>
>>>>>>
>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>set incorrectly.
>>>>>>
>>>>>
>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>
>>>>>--
>>>>>==================
>>>>>Remove the "x" from my email address
>>>>>Jerry Stuckle
>>>>>JDS Computer Training Corp.
>>>>>js*******@attglobal.net
>>>>>==================
>>>>
>>>>
>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>chmodding etc.
>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>upload it, and
>>>>have the upload script up and running ... ?
>>>>
>>>>Frizzle.
>>>>
>>>
>>>Frizzle,
>>>
>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>web server are.
>>>
>>>When you ftp a file to the server, the owner of the file is the userid who
>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>the web server, and the owner is the userid of the server itself.
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>Ok, thanks.
>>Not to go on and on about this, but the other thing i asked is
>>impossible as well then?
>>
>> "So i could mail a zipfile to a client, tell them to unpack it and
>>upload it,
>> and have the upload script up and running ... ?"
>>
>>Frizzle.
>>
>
>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>server's configuration is screwed up). It's when you try to mix the two you
>start running into permission problems and need to chmod.
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
owkaaaaayyyy, i never realized ftp and uploading aren't the same
thing...
I don't need to mix them, i need a script to upload files, wich can
prefferably
run without any chmodding etc.

Frizzle.
Ok, you just need to ensure you have the original directory permissions set
properly, then. In a typical installation the directory would be owned by the
webserver's userid with permissions of 755.

And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
command. In either case the file ends up on the server. But how it gets there
is much different.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
folders are standard chmodded 755.
That should be allright then ...

Frizzle.


*Should be* is the key. If your host has things set ip properly, then yes you
should be OK. But if not...

And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
transfer files. I suspect Plesk does, also.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Well, ok, but where should i focus now to build a script to upload
files to my server?
FTP, or an other file transfer method?
It would be ideal if i could also create / delete folders ...

Frizzle.

Apr 7 '06 #18
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>frizzle wrote:
>>
>>
>>
>>>Jerry Stuckle wrote:
>>>
>>>
>>>
>>>
>>>>frizzle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Jerry Stuckle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Gary L. Burnore wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>--- --- '
>>>>>>>>>>
>>>
>>>
>>>>>>>>>>Frizzle.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>
>>>>>>>>>Frizzle.
>>>>>>>>>
>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>
>>>>>>>>
>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>
>>>>>>>
>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>set incorrectly.
>>>>>>>
>>>>>>
>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>
>>>>>>--
>>>>>>==================
>>>>>>Remove the "x" from my email address
>>>>>>Jerry Stuckle
>>>>>>JDS Computer Training Corp.
>>>>>>js*******@attglobal.net
>>>>>>==================
>>>>>
>>>>>
>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>chmodding etc.
>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>upload it, and
>>>>>have the upload script up and running ... ?
>>>>>
>>>>>Frizzle.
>>>>>
>>>>
>>>>Frizzle,
>>>>
>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>web server are.
>>>>
>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>the web server, and the owner is the userid of the server itself.
>>>>
>>>>--
>>>>==================
>>>>Remove the "x" from my email address
>>>>Jerry Stuckle
>>>>JDS Computer Training Corp.
>>>>js*******@attglobal.net
>>>>==================
>>>
>>>
>>>Ok, thanks.
>>>Not to go on and on about this, but the other thing i asked is
>>>impossible as well then?
>>>
>>> "So i could mail a zipfile to a client, tell them to unpack it and
>>>upload it,
>>> and have the upload script up and running ... ?"
>>>
>>>Frizzle.
>>>
>>
>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>server's configuration is screwed up). It's when you try to mix the two you
>>start running into permission problems and need to chmod.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>thing...
>I don't need to mix them, i need a script to upload files, wich can
>prefferably
>run without any chmodding etc.
>
>Frizzle.
>

Ok, you just need to ensure you have the original directory permissions set
properly, then. In a typical installation the directory would be owned by the
webserver's userid with permissions of 755.

And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
command. In either case the file ends up on the server. But how it gets there
is much different.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
folders are standard chmodded 755.
That should be allright then ...

Frizzle.


*Should be* is the key. If your host has things set ip properly, then yes you
should be OK. But if not...

And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
transfer files. I suspect Plesk does, also.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Well, ok, but where should i focus now to build a script to upload
files to my server?
FTP, or an other file transfer method?
It would be ideal if i could also create / delete folders ...

Frizzle.

Frizzle,

It depends on how you want to do things. If you're going to be the only one
uploading, you can do ftp or http uploads. If you have users who may not be
familiar with ftp, you should do http uploads.

The downside of http uploads is you can't synchronize files between your local
copy and the website with products like Dreamweaver.

You can create and delete directories in PHP also, assuming your host hasn't
disabled these functions and you have the appropriate permissions. So that's
not a problem.

It's all in how you want to maintain your site.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 7 '06 #19

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>Jerry Stuckle wrote:
>>
>>
>>
>>>frizzle wrote:
>>>
>>>
>>>
>>>>Jerry Stuckle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>frizzle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Jerry Stuckle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Gary L. Burnore wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>--- --- '
>>>>>>>>>>>
>>>>
>>>>
>>>>>>>>>>>Frizzle.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>
>>>>>>>>>>Frizzle.
>>>>>>>>>>
>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>
>>>>>>>>
>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>set incorrectly.
>>>>>>>>
>>>>>>>
>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>
>>>>>>>--
>>>>>>>==================
>>>>>>>Remove the "x" from my email address
>>>>>>>Jerry Stuckle
>>>>>>>JDS Computer Training Corp.
>>>>>>>js*******@attglobal.net
>>>>>>>==================
>>>>>>
>>>>>>
>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>chmodding etc.
>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>upload it, and
>>>>>>have the upload script up and running ... ?
>>>>>>
>>>>>>Frizzle.
>>>>>>
>>>>>
>>>>>Frizzle,
>>>>>
>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>web server are.
>>>>>
>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>the web server, and the owner is the userid of the server itself.
>>>>>
>>>>>--
>>>>>==================
>>>>>Remove the "x" from my email address
>>>>>Jerry Stuckle
>>>>>JDS Computer Training Corp.
>>>>>js*******@attglobal.net
>>>>>==================
>>>>
>>>>
>>>>Ok, thanks.
>>>>Not to go on and on about this, but the other thing i asked is
>>>>impossible as well then?
>>>>
>>>> "So i could mail a zipfile to a client, tell them to unpack it and
>>>>upload it,
>>>> and have the upload script up and running ... ?"
>>>>
>>>>Frizzle.
>>>>
>>>
>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>server's configuration is screwed up). It's when you try to mix the two you
>>>start running into permission problems and need to chmod.
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>thing...
>>I don't need to mix them, i need a script to upload files, wich can
>>prefferably
>>run without any chmodding etc.
>>
>>Frizzle.
>>
>
>Ok, you just need to ensure you have the original directory permissions set
>properly, then. In a typical installation the directory would be owned by the
>webserver's userid with permissions of 755.
>
>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>command. In either case the file ends up on the server. But how it gets there
>is much different.
>
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
folders are standard chmodded 755.
That should be allright then ...

Frizzle.
*Should be* is the key. If your host has things set ip properly, then yes you
should be OK. But if not...

And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
transfer files. I suspect Plesk does, also.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Well, ok, but where should i focus now to build a script to upload
files to my server?
FTP, or an other file transfer method?
It would be ideal if i could also create / delete folders ...

Frizzle.

Frizzle,

It depends on how you want to do things. If you're going to be the only one
uploading, you can do ftp or http uploads. If you have users who may not be
familiar with ftp, you should do http uploads.

The downside of http uploads is you can't synchronize files between your local
copy and the website with products like Dreamweaver.

You can create and delete directories in PHP also, assuming your host hasn't
disabled these functions and you have the appropriate permissions. So that's
not a problem.

It's all in how you want to maintain your site.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


It's meant for a user based site; users with certain priviledges are
allowed to add news and files to the site. No synchronizing
needed. Mostly images and mp3's, maybe some docs etc.

Frizzle.

Apr 7 '06 #20
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>frizzle wrote:
>>
>>
>>
>>>Jerry Stuckle wrote:
>>>
>>>
>>>
>>>
>>>>frizzle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Jerry Stuckle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>frizzle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Jerry Stuckle wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Gary L. Burnore wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>>.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>>--- --- '
>>>>>>>>>>>>
>>>>>
>>>>>
>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>>
>>>>>>>>>>>Frizzle.
>>>>>>>>>>>
>>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>>set incorrectly.
>>>>>>>>>
>>>>>>>>
>>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>>
>>>>>>>>--
>>>>>>>>==================
>>>>>>>>Remove the "x" from my email address
>>>>>>>>Jerry Stuckle
>>>>>>>>JDS Computer Training Corp.
>>>>>>>>js*******@attglobal.net
>>>>>>>>==================
>>>>>>>
>>>>>>>
>>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>>chmodding etc.
>>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>upload it, and
>>>>>>>have the upload script up and running ... ?
>>>>>>>
>>>>>>>Frizzle.
>>>>>>>
>>>>>>
>>>>>>Frizzle,
>>>>>>
>>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>>web server are.
>>>>>>
>>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>>the web server, and the owner is the userid of the server itself.
>>>>>>
>>>>>>--
>>>>>>==================
>>>>>>Remove the "x" from my email address
>>>>>>Jerry Stuckle
>>>>>>JDS Computer Training Corp.
>>>>>>js*******@attglobal.net
>>>>>>==================
>>>>>
>>>>>
>>>>>Ok, thanks.
>>>>>Not to go on and on about this, but the other thing i asked is
>>>>>impossible as well then?
>>>>>
>>>>>"So i could mail a zipfile to a client, tell them to unpack it and
>>>>>upload it,
>>>>> and have the upload script up and running ... ?"
>>>>>
>>>>>Frizzle.
>>>>>
>>>>
>>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>>server's configuration is screwed up). It's when you try to mix the two you
>>>>start running into permission problems and need to chmod.
>>>>
>>>>--
>>>>==================
>>>>Remove the "x" from my email address
>>>>Jerry Stuckle
>>>>JDS Computer Training Corp.
>>>>js*******@attglobal.net
>>>>==================
>>>
>>>
>>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>>thing...
>>>I don't need to mix them, i need a script to upload files, wich can
>>>prefferably
>>>run without any chmodding etc.
>>>
>>>Frizzle.
>>>
>>
>>Ok, you just need to ensure you have the original directory permissions set
>>properly, then. In a typical installation the directory would be owned by the
>>webserver's userid with permissions of 755.
>>
>>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>>command. In either case the file ends up on the server. But how it gets there
>>is much different.
>>
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
>folders are standard chmodded 755.
>That should be allright then ...
>
>Frizzle.
>

*Should be* is the key. If your host has things set ip properly, then yes you
should be OK. But if not...

And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
transfer files. I suspect Plesk does, also.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Well, ok, but where should i focus now to build a script to upload
files to my server?
FTP, or an other file transfer method?
It would be ideal if i could also create / delete folders ...

Frizzle.

Frizzle,

It depends on how you want to do things. If you're going to be the only one
uploading, you can do ftp or http uploads. If you have users who may not be
familiar with ftp, you should do http uploads.

The downside of http uploads is you can't synchronize files between your local
copy and the website with products like Dreamweaver.

You can create and delete directories in PHP also, assuming your host hasn't
disabled these functions and you have the appropriate permissions. So that's
not a problem.

It's all in how you want to maintain your site.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

It's meant for a user based site; users with certain priviledges are
allowed to add news and files to the site. No synchronizing
needed. Mostly images and mp3's, maybe some docs etc.

Frizzle.


In that case I would suggest http uploads.

Maybe the easiest way is to have an admin page where you can let PHP create the
root directory(s) you wish, then let the main part of the site upload into these
directories and, if necessary, create new directories.

If the webserver creates them it will be the owner, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 8 '06 #21

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>Jerry Stuckle wrote:
>>
>>
>>
>>>frizzle wrote:
>>>
>>>
>>>
>>>>Jerry Stuckle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>frizzle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Jerry Stuckle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>frizzle wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Gary L. Burnore wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>>>.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>>>--- --- '
>>>>>>>>>>>>>
>>>>>>
>>>>>>
>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>>>
>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>
>>>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>>>set incorrectly.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>>>
>>>>>>>>>--
>>>>>>>>>==================
>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>Jerry Stuckle
>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>js*******@attglobal.net
>>>>>>>>>==================
>>>>>>>>
>>>>>>>>
>>>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>>>chmodding etc.
>>>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>upload it, and
>>>>>>>>have the upload script up and running ... ?
>>>>>>>>
>>>>>>>>Frizzle.
>>>>>>>>
>>>>>>>
>>>>>>>Frizzle,
>>>>>>>
>>>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>>>web server are.
>>>>>>>
>>>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>>>the web server, and the owner is the userid of the server itself.
>>>>>>>
>>>>>>>--
>>>>>>>==================
>>>>>>>Remove the "x" from my email address
>>>>>>>Jerry Stuckle
>>>>>>>JDS Computer Training Corp.
>>>>>>>js*******@attglobal.net
>>>>>>>==================
>>>>>>
>>>>>>
>>>>>>Ok, thanks.
>>>>>>Not to go on and on about this, but the other thing i asked is
>>>>>>impossible as well then?
>>>>>>
>>>>>>"So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>upload it,
>>>>>> and have the upload script up and running ... ?"
>>>>>>
>>>>>>Frizzle.
>>>>>>
>>>>>
>>>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>>>server's configuration is screwed up). It's when you try to mix the two you
>>>>>start running into permission problems and need to chmod.
>>>>>
>>>>>--
>>>>>==================
>>>>>Remove the "x" from my email address
>>>>>Jerry Stuckle
>>>>>JDS Computer Training Corp.
>>>>>js*******@attglobal.net
>>>>>==================
>>>>
>>>>
>>>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>>>thing...
>>>>I don't need to mix them, i need a script to upload files, wich can
>>>>prefferably
>>>>run without any chmodding etc.
>>>>
>>>>Frizzle.
>>>>
>>>
>>>Ok, you just need to ensure you have the original directory permissions set
>>>properly, then. In a typical installation the directory would be owned by the
>>>webserver's userid with permissions of 755.
>>>
>>>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>>>command. In either case the file ends up on the server. But how it gets there
>>>is much different.
>>>
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
>>folders are standard chmodded 755.
>>That should be allright then ...
>>
>>Frizzle.
>>
>
>*Should be* is the key. If your host has things set ip properly, then yes you
>should be OK. But if not...
>
>And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
>transfer files. I suspect Plesk does, also.
>
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
Well, ok, but where should i focus now to build a script to upload
files to my server?
FTP, or an other file transfer method?
It would be ideal if i could also create / delete folders ...

Frizzle.

Frizzle,

It depends on how you want to do things. If you're going to be the only one
uploading, you can do ftp or http uploads. If you have users who may not be
familiar with ftp, you should do http uploads.

The downside of http uploads is you can't synchronize files between your local
copy and the website with products like Dreamweaver.

You can create and delete directories in PHP also, assuming your host hasn't
disabled these functions and you have the appropriate permissions. So that's
not a problem.

It's all in how you want to maintain your site.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

It's meant for a user based site; users with certain priviledges are
allowed to add news and files to the site. No synchronizing
needed. Mostly images and mp3's, maybe some docs etc.

Frizzle.


In that case I would suggest http uploads.

Maybe the easiest way is to have an admin page where you can let PHP create the
root directory(s) you wish, then let the main part of the site upload into these
directories and, if necessary, create new directories.

If the webserver creates them it will be the owner, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Hmm, hope i'm not back at the start (the chmodding part) i get an
error:

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 10008 is not allowed to access / owned by uid 0 in
/home/httpd/vhosts/host.com/httpdocs/test/admin/ftp2.php on line 17

Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpejdmGr
[error] => 0
[size] => 11469
)

)
Does this have something to do with the Chmodding again ? (Please tell
me it doesn't...)

Frizzle.

Apr 9 '06 #22
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>frizzle wrote:
>>
>>
>>
>>>Jerry Stuckle wrote:
>>>
>>>
>>>
>>>
>>>>frizzle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Jerry Stuckle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>frizzle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Jerry Stuckle wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>frizzle wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>Gary L. Burnore wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>>>>.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>>>>--- --- '
>>>>>>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>>>>
>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>
>>>>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>>>>set incorrectly.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>>>>
>>>>>>>>>>--
>>>>>>>>>>==================
>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>==================
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>>>>chmodding etc.
>>>>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>upload it, and
>>>>>>>>>have the upload script up and running ... ?
>>>>>>>>>
>>>>>>>>>Frizzle.
>>>>>>>>>
>>>>>>>>
>>>>>>>>Frizzle,
>>>>>>>>
>>>>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>>>>web server are.
>>>>>>>>
>>>>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>>>>the web server, and the owner is the userid of the server itself.
>>>>>>>>
>>>>>>>>--
>>>>>>>>==================
>>>>>>>>Remove the "x" from my email address
>>>>>>>>Jerry Stuckle
>>>>>>>>JDS Computer Training Corp.
>>>>>>>>js*******@attglobal.net
>>>>>>>>==================
>>>>>>>
>>>>>>>
>>>>>>>Ok, thanks.
>>>>>>>Not to go on and on about this, but the other thing i asked is
>>>>>>>impossible as well then?
>>>>>>>
>>>>>>>"So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>upload it,
>>>>>>>and have the upload script up and running ... ?"
>>>>>>>
>>>>>>>Frizzle.
>>>>>>>
>>>>>>
>>>>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>>>>server's configuration is screwed up). It's when you try to mix the two you
>>>>>>start running into permission problems and need to chmod.
>>>>>>
>>>>>>--
>>>>>>==================
>>>>>>Remove the "x" from my email address
>>>>>>Jerry Stuckle
>>>>>>JDS Computer Training Corp.
>>>>>>js*******@attglobal.net
>>>>>>==================
>>>>>
>>>>>
>>>>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>>>>thing...
>>>>>I don't need to mix them, i need a script to upload files, wich can
>>>>>prefferably
>>>>>run without any chmodding etc.
>>>>>
>>>>>Frizzle.
>>>>>
>>>>
>>>>Ok, you just need to ensure you have the original directory permissions set
>>>>properly, then. In a typical installation the directory would be owned by the
>>>>webserver's userid with permissions of 755.
>>>>
>>>>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>>>>command. In either case the file ends up on the server. But how it gets there
>>>>is much different.
>>>>
>>>>
>>>>--
>>>>==================
>>>>Remove the "x" from my email address
>>>>Jerry Stuckle
>>>>JDS Computer Training Corp.
>>>>js*******@attglobal.net
>>>>==================
>>>
>>>
>>>When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
>>>folders are standard chmodded 755.
>>>That should be allright then ...
>>>
>>>Frizzle.
>>>
>>
>>*Should be* is the key. If your host has things set ip properly, then yes you
>>should be OK. But if not...
>>
>>And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
>>transfer files. I suspect Plesk does, also.
>>
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>Well, ok, but where should i focus now to build a script to upload
>files to my server?
>FTP, or an other file transfer method?
>It would be ideal if i could also create / delete folders ...
>
>Frizzle.
>
Frizzle,

It depends on how you want to do things. If you're going to be the only one
uploading, you can do ftp or http uploads. If you have users who may not be
familiar with ftp, you should do http uploads.

The downside of http uploads is you can't synchronize files between your local
copy and the website with products like Dreamweaver.

You can create and delete directories in PHP also, assuming your host hasn't
disabled these functions and you have the appropriate permissions. So that's
not a problem.

It's all in how you want to maintain your site.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
It's meant for a user based site; users with certain priviledges are
allowed to add news and files to the site. No synchronizing
needed. Mostly images and mp3's, maybe some docs etc.

Frizzle.


In that case I would suggest http uploads.

Maybe the easiest way is to have an admin page where you can let PHP create the
root directory(s) you wish, then let the main part of the site upload into these
directories and, if necessary, create new directories.

If the webserver creates them it will be the owner, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Hmm, hope i'm not back at the start (the chmodding part) i get an
error:

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 10008 is not allowed to access / owned by uid 0 in
/home/httpd/vhosts/host.com/httpdocs/test/admin/ftp2.php on line 17

Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpejdmGr
[error] => 0
[size] => 11469
)

)
Does this have something to do with the Chmodding again ? (Please tell
me it doesn't...)

Frizzle.


I have no idea - don't know what code you're using.

But it looks like you're trying to access the system root directory ('/') -
which is owned by root. You can't do it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 9 '06 #23
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>Jerry Stuckle wrote:
>>
>>
>>
>>>frizzle wrote:
>>>
>>>
>>>
>>>>Jerry Stuckle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>frizzle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Jerry Stuckle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>frizzle wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>frizzle wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>Gary L. Burnore wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>>>>>.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>>>>>--- --- '
>>>>>>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>>>>>set incorrectly.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>>>>>
>>>>>>>>>>>--
>>>>>>>>>>>==================
>>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>>==================
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>>>>>chmodding etc.
>>>>>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>>upload it, and
>>>>>>>>>>have the upload script up and running ... ?
>>>>>>>>>>
>>>>>>>>>>Frizzle.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>Frizzle,
>>>>>>>>>
>>>>>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>>>>>web server are.
>>>>>>>>>
>>>>>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>>>>>the web server, and the owner is the userid of the server itself.
>>>>>>>>>
>>>>>>>>>--
>>>>>>>>>==================
>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>Jerry Stuckle
>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>js*******@attglobal.net
>>>>>>>>>==================
>>>>>>>>
>>>>>>>>
>>>>>>>>Ok, thanks.
>>>>>>>>Not to go on and on about this, but the other thing i asked is
>>>>>>>>impossible as well then?
>>>>>>>>
>>>>>>>>"So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>upload it,
>>>>>>>>and have the upload script up and running ... ?"
>>>>>>>>
>>>>>>>>Frizzle.
>>>>>>>>
>>>>>>>
>>>>>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>>>>>server's configuration is screwed up). It's when you try to mix the two you
>>>>>>>start running into permission problems and need to chmod.
>>>>>>>
>>>>>>>--
>>>>>>>==================
>>>>>>>Remove the "x" from my email address
>>>>>>>Jerry Stuckle
>>>>>>>JDS Computer Training Corp.
>>>>>>>js*******@attglobal.net
>>>>>>>==================
>>>>>>
>>>>>>
>>>>>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>>>>>thing...
>>>>>>I don't need to mix them, i need a script to upload files, wich can
>>>>>>prefferably
>>>>>>run without any chmodding etc.
>>>>>>
>>>>>>Frizzle.
>>>>>>
>>>>>
>>>>>Ok, you just need to ensure you have the original directory permissions set
>>>>>properly, then. In a typical installation the directory would be owned by the
>>>>>webserver's userid with permissions of 755.
>>>>>
>>>>>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>>>>>command. In either case the file ends up on the server. But how it gets there
>>>>>is much different.
>>>>>
>>>>>
>>>>>--
>>>>>==================
>>>>>Remove the "x" from my email address
>>>>>Jerry Stuckle
>>>>>JDS Computer Training Corp.
>>>>>js*******@attglobal.net
>>>>>==================
>>>>
>>>>
>>>>When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
>>>>folders are standard chmodded 755.
>>>>That should be allright then ...
>>>>
>>>>Frizzle.
>>>>
>>>
>>>*Should be* is the key. If your host has things set ip properly, then yes you
>>>should be OK. But if not...
>>>
>>>And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
>>>transfer files. I suspect Plesk does, also.
>>>
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>Well, ok, but where should i focus now to build a script to upload
>>files to my server?
>>FTP, or an other file transfer method?
>>It would be ideal if i could also create / delete folders ...
>>
>>Frizzle.
>>
>
>
>Frizzle,
>
>It depends on how you want to do things. If you're going to be the only one
>uploading, you can do ftp or http uploads. If you have users who may not be
>familiar with ftp, you should do http uploads.
>
>The downside of http uploads is you can't synchronize files between your local
>copy and the website with products like Dreamweaver.
>
>You can create and delete directories in PHP also, assuming your host hasn't
>disabled these functions and you have the appropriate permissions. So that's
>not a problem.
>
>It's all in how you want to maintain your site.
>
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
It's meant for a user based site; users with certain priviledges are
allowed to add news and files to the site. No synchronizing
needed. Mostly images and mp3's, maybe some docs etc.

Frizzle.
In that case I would suggest http uploads.

Maybe the easiest way is to have an admin page where you can let PHP create the
root directory(s) you wish, then let the main part of the site upload into these
directories and, if necessary, create new directories.

If the webserver creates them it will be the owner, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Hmm, hope i'm not back at the start (the chmodding part) i get an
error:

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 10008 is not allowed to access / owned by uid 0 in
/home/httpd/vhosts/host.com/httpdocs/test/admin/ftp2.php on line 17

Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpejdmGr
[error] => 0
[size] => 11469
)

)
Does this have something to do with the Chmodding again ? (Please tell
me it doesn't...)

Frizzle.


I have no idea - don't know what code you're using.

But it looks like you're trying to access the system root directory ('/') -
which is owned by root. You can't do it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

You were right, i forgot a dot (shame on me) in the path. My code is
below.
Having fixed that, it gave me the next (of how many :s ) error:

--- ERROR ---

Warning:
move_uploaded_file(/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg):
failed to open stream: Permission denied in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Warning: move_uploaded_file(): Unable to move '/tmp/phpzeJkaC' to
'/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg' in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Possible file upload attack!
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpzeJkaC
[error] => 0
[size] => 11469
)

)

--- END ERROR ---

The folder i'm trying to access is /test/admin/uploads
and it does exist. (checked).
I hope you can tel me what's wrong. Anyway, i really appreciate all
your effort for trying to help me!

Frizzle.

My entire exact code is below:

++++++++++++++++++++++++++++++++++++++++++++++

<?php

require_once('../inc/globals.php');

/*$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b><br>FTP Host Niot Found!');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<b>Error!</b><br>Wrong FTP-login name or FTP-pass!');

@ftp_close( $ftp_conn );*/

if( isset( $_FILES['userfile'] ) ){
$uploaddir = './uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="userfile" type="file" id="userfile">
<br>
<input type="submit" name="upload" id="upload" value="Upload!">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:if(confirm('Sure?')){ history.go(-1) }else{}">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file : filetype:
" . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>

++++++++++++++++++++++++++++++++++++++++++++++

Apr 10 '06 #24
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>frizzle wrote:
>>
>>
>>
>>>Jerry Stuckle wrote:
>>>
>>>
>>>
>>>
>>>>frizzle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Jerry Stuckle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>frizzle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Jerry Stuckle wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>frizzle wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>frizzle wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>Gary L. Burnore wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>>>>>>.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>>>>>>--- --- '
>>>>>>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>>>>>>set incorrectly.
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>>>>>>
>>>>>>>>>>>>--
>>>>>>>>>>>>==================
>>>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>>>==================
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>>>>>>chmodding etc.
>>>>>>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>>>upload it, and
>>>>>>>>>>>have the upload script up and running ... ?
>>>>>>>>>>>
>>>>>>>>>>>Frizzle.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Frizzle,
>>>>>>>>>>
>>>>>>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>>>>>>web server are.
>>>>>>>>>>
>>>>>>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>>>>>>the web server, and the owner is the userid of the server itself.
>>>>>>>>>>
>>>>>>>>>>--
>>>>>>>>>>==================
>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>==================
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>Ok, thanks.
>>>>>>>>>Not to go on and on about this, but the other thing i asked is
>>>>>>>>>impossible as well then?
>>>>>>>>>
>>>>>>>>>"So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>upload it,
>>>>>>>>>and have the upload script up and running ... ?"
>>>>>>>>>
>>>>>>>>>Frizzle.
>>>>>>>>>
>>>>>>>>
>>>>>>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>>>>>>server's configuration is screwed up). It's when you try to mix the two you
>>>>>>>>start running into permission problems and need to chmod.
>>>>>>>>
>>>>>>>>--
>>>>>>>>==================
>>>>>>>>Remove the "x" from my email address
>>>>>>>>Jerry Stuckle
>>>>>>>>JDS Computer Training Corp.
>>>>>>>>js*******@attglobal.net
>>>>>>>>==================
>>>>>>>
>>>>>>>
>>>>>>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>>>>>>thing...
>>>>>>>I don't need to mix them, i need a script to upload files, wich can
>>>>>>>prefferably
>>>>>>>run without any chmodding etc.
>>>>>>>
>>>>>>>Frizzle.
>>>>>>>
>>>>>>
>>>>>>Ok, you just need to ensure you have the original directory permissions set
>>>>>>properly, then. In a typical installation the directory would be owned by the
>>>>>>webserver's userid with permissions of 755.
>>>>>>
>>>>>>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>>>>>>command. In either case the file ends up on the server. But how it gets there
>>>>>>is much different.
>>>>>>
>>>>>>
>>>>>>--
>>>>>>==================
>>>>>>Remove the "x" from my email address
>>>>>>Jerry Stuckle
>>>>>>JDS Computer Training Corp.
>>>>>>js*******@attglobal.net
>>>>>>==================
>>>>>
>>>>>
>>>>>When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
>>>>>folders are standard chmodded 755.
>>>>>That should be allright then ...
>>>>>
>>>>>Frizzle.
>>>>>
>>>>
>>>>*Should be* is the key. If your host has things set ip properly, then yes you
>>>>should be OK. But if not...
>>>>
>>>>And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
>>>>transfer files. I suspect Plesk does, also.
>>>>
>>>>
>>>>--
>>>>==================
>>>>Remove the "x" from my email address
>>>>Jerry Stuckle
>>>>JDS Computer Training Corp.
>>>>js*******@attglobal.net
>>>>==================
>>>
>>>
>>>Well, ok, but where should i focus now to build a script to upload
>>>files to my server?
>>>FTP, or an other file transfer method?
>>>It would be ideal if i could also create / delete folders ...
>>>
>>>Frizzle.
>>>
>>
>>
>>Frizzle,
>>
>>It depends on how you want to do things. If you're going to be the only one
>>uploading, you can do ftp or http uploads. If you have users who may not be
>>familiar with ftp, you should do http uploads.
>>
>>The downside of http uploads is you can't synchronize files between your local
>>copy and the website with products like Dreamweaver.
>>
>>You can create and delete directories in PHP also, assuming your host hasn't
>>disabled these functions and you have the appropriate permissions. So that's
>>not a problem.
>>
>>It's all in how you want to maintain your site.
>>
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>It's meant for a user based site; users with certain priviledges are
>allowed to add news and files to the site. No synchronizing
>needed. Mostly images and mp3's, maybe some docs etc.
>
>Frizzle.
>

In that case I would suggest http uploads.

Maybe the easiest way is to have an admin page where you can let PHP create the
root directory(s) you wish, then let the main part of the site upload into these
directories and, if necessary, create new directories.

If the webserver creates them it will be the owner, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Hmm, hope i'm not back at the start (the chmodding part) i get an
error:

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 10008 is not allowed to access / owned by uid 0 in
/home/httpd/vhosts/host.com/httpdocs/test/admin/ftp2.php on line 17

Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpejdmGr
[error] => 0
[size] => 11469
)

)
Does this have something to do with the Chmodding again ? (Please tell
me it doesn't...)

Frizzle.


I have no idea - don't know what code you're using.

But it looks like you're trying to access the system root directory ('/') -
which is owned by root. You can't do it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


You were right, i forgot a dot (shame on me) in the path. My code is
below.
Having fixed that, it gave me the next (of how many :s ) error:

--- ERROR ---

Warning:
move_uploaded_file(/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg):
failed to open stream: Permission denied in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Warning: move_uploaded_file(): Unable to move '/tmp/phpzeJkaC' to
'/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg' in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Possible file upload attack!
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpzeJkaC
[error] => 0
[size] => 11469
)

)

--- END ERROR ---

The folder i'm trying to access is /test/admin/uploads
and it does exist. (checked).
I hope you can tel me what's wrong. Anyway, i really appreciate all
your effort for trying to help me!

Frizzle.

My entire exact code is below:

++++++++++++++++++++++++++++++++++++++++++++++

<?php

require_once('../inc/globals.php');

/*$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b><br>FTP Host Niot Found!');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<b>Error!</b><br>Wrong FTP-login name or FTP-pass!');

@ftp_close( $ftp_conn );*/

if( isset( $_FILES['userfile'] ) ){
$uploaddir = './uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="userfile" type="file" id="userfile">
<br>
<input type="submit" name="upload" id="upload" value="Upload!">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:if(confirm('Sure?')){ history.go(-1) }else{}">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file : filetype:
" . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>

++++++++++++++++++++++++++++++++++++++++++++++

OK, who owns the directory, and what are its flags? And what's the userid of
the webserver?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 11 '06 #25

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>Jerry Stuckle wrote:
>>
>>
>>
>>>frizzle wrote:
>>>
>>>
>>>
>>>>Jerry Stuckle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>frizzle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Jerry Stuckle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>frizzle wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>frizzle wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>frizzle wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>Gary L. Burnore wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>>>>>>>.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>>>>>>>--- --- '
>>>>>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>>>>>>>set incorrectly.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>>>>>>>
>>>>>>>>>>>>>--
>>>>>>>>>>>>>==================
>>>>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>>>>==================
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>>>>>>>chmodding etc.
>>>>>>>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>>>>upload it, and
>>>>>>>>>>>>have the upload script up and running ... ?
>>>>>>>>>>>>
>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Frizzle,
>>>>>>>>>>>
>>>>>>>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>>>>>>>web server are.
>>>>>>>>>>>
>>>>>>>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>>>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>>>>>>>the web server, and the owner is the userid of the server itself.
>>>>>>>>>>>
>>>>>>>>>>>--
>>>>>>>>>>>==================
>>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>>==================
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Ok, thanks.
>>>>>>>>>>Not to go on and on about this, but the other thing i asked is
>>>>>>>>>>impossible as well then?
>>>>>>>>>>
>>>>>>>>>>"So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>>upload it,
>>>>>>>>>>and have the upload script up and running ... ?"
>>>>>>>>>>
>>>>>>>>>>Frizzle.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>>>>>>>server's configuration is screwed up). It's when you try to mix the two you
>>>>>>>>>start running into permission problems and need to chmod.
>>>>>>>>>
>>>>>>>>>--
>>>>>>>>>==================
>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>Jerry Stuckle
>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>js*******@attglobal.net
>>>>>>>>>==================
>>>>>>>>
>>>>>>>>
>>>>>>>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>>>>>>>thing...
>>>>>>>>I don't need to mix them, i need a script to upload files, wich can
>>>>>>>>prefferably
>>>>>>>>run without any chmodding etc.
>>>>>>>>
>>>>>>>>Frizzle.
>>>>>>>>
>>>>>>>
>>>>>>>Ok, you just need to ensure you have the original directory permissions set
>>>>>>>properly, then. In a typical installation the directory would be owned by the
>>>>>>>webserver's userid with permissions of 755.
>>>>>>>
>>>>>>>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>>>>>>>command. In either case the file ends up on the server. But how it gets there
>>>>>>>is much different.
>>>>>>>
>>>>>>>
>>>>>>>--
>>>>>>>==================
>>>>>>>Remove the "x" from my email address
>>>>>>>Jerry Stuckle
>>>>>>>JDS Computer Training Corp.
>>>>>>>js*******@attglobal.net
>>>>>>>==================
>>>>>>
>>>>>>
>>>>>>When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
>>>>>>folders are standard chmodded 755.
>>>>>>That should be allright then ...
>>>>>>
>>>>>>Frizzle.
>>>>>>
>>>>>
>>>>>*Should be* is the key. If your host has things set ip properly, then yes you
>>>>>should be OK. But if not...
>>>>>
>>>>>And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
>>>>>transfer files. I suspect Plesk does, also.
>>>>>
>>>>>
>>>>>--
>>>>>==================
>>>>>Remove the "x" from my email address
>>>>>Jerry Stuckle
>>>>>JDS Computer Training Corp.
>>>>>js*******@attglobal.net
>>>>>==================
>>>>
>>>>
>>>>Well, ok, but where should i focus now to build a script to upload
>>>>files to my server?
>>>>FTP, or an other file transfer method?
>>>>It would be ideal if i could also create / delete folders ...
>>>>
>>>>Frizzle.
>>>>
>>>
>>>
>>>Frizzle,
>>>
>>>It depends on how you want to do things. If you're going to be the only one
>>>uploading, you can do ftp or http uploads. If you have users who may not be
>>>familiar with ftp, you should do http uploads.
>>>
>>>The downside of http uploads is you can't synchronize files between your local
>>>copy and the website with products like Dreamweaver.
>>>
>>>You can create and delete directories in PHP also, assuming your host hasn't
>>>disabled these functions and you have the appropriate permissions. So that's
>>>not a problem.
>>>
>>>It's all in how you want to maintain your site.
>>>
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>It's meant for a user based site; users with certain priviledges are
>>allowed to add news and files to the site. No synchronizing
>>needed. Mostly images and mp3's, maybe some docs etc.
>>
>>Frizzle.
>>
>
>In that case I would suggest http uploads.
>
>Maybe the easiest way is to have an admin page where you can let PHP create the
>root directory(s) you wish, then let the main part of the site upload into these
>directories and, if necessary, create new directories.
>
>If the webserver creates them it will be the owner, also.
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
Hmm, hope i'm not back at the start (the chmodding part) i get an
error:

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
script whose uid is 10008 is not allowed to access / owned by uid 0 in
/home/httpd/vhosts/host.com/httpdocs/test/admin/ftp2.php on line 17

Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpejdmGr
[error] => 0
[size] => 11469
)

)
Does this have something to do with the Chmodding again ? (Please tell
me it doesn't...)

Frizzle.
I have no idea - don't know what code you're using.

But it looks like you're trying to access the system root directory ('/') -
which is owned by root. You can't do it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


You were right, i forgot a dot (shame on me) in the path. My code is
below.
Having fixed that, it gave me the next (of how many :s ) error:

--- ERROR ---

Warning:
move_uploaded_file(/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg):
failed to open stream: Permission denied in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Warning: move_uploaded_file(): Unable to move '/tmp/phpzeJkaC' to
'/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg' in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Possible file upload attack!
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpzeJkaC
[error] => 0
[size] => 11469
)

)

--- END ERROR ---

The folder i'm trying to access is /test/admin/uploads
and it does exist. (checked).
I hope you can tel me what's wrong. Anyway, i really appreciate all
your effort for trying to help me!

Frizzle.

My entire exact code is below:

++++++++++++++++++++++++++++++++++++++++++++++

<?php

require_once('../inc/globals.php');

/*$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b><br>FTP Host Niot Found!');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<b>Error!</b><br>Wrong FTP-login name or FTP-pass!');

@ftp_close( $ftp_conn );*/

if( isset( $_FILES['userfile'] ) ){
$uploaddir = './uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="userfile" type="file" id="userfile">
<br>
<input type="submit" name="upload" id="upload" value="Upload!">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:if(confirm('Sure?')){ history.go(-1) }else{}">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file : filetype:
" . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>

++++++++++++++++++++++++++++++++++++++++++++++

OK, who owns the directory, and what are its flags? And what's the userid of
the webserver?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


User: domainname
Group: psacln
Permissions: rwx r-x r-x

Userid i don't know. How could i check that ?

Frizzle.

Apr 11 '06 #26
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>frizzle wrote:
>>
>>
>>
>>>Jerry Stuckle wrote:
>>>
>>>
>>>
>>>
>>>>frizzle wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Jerry Stuckle wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>frizzle wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Jerry Stuckle wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>frizzle wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>frizzle wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>frizzle wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>Jerry Stuckle wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>Gary L. Burnore wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
>>>>>>>>>>>>>>><js*******@attglobal.net> wrote:
>>>>>>>>>>>>>>>.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>Standard (DW created files/dirs) have user 'domainname', permissions
>>>>>>>>>>>>>>>>>>'rwx r-x r-x ',
>>>>>>>>>>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
>>>>>>>>>>>>>>>>>>--- --- '
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
>>>>>>>>>>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
>>>>>>>>>>>>>>>>>with, say, DreamWeaver or WS_FTP ?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>Only if you can ftp in as the web server.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
>>>>>>>>>>>>>>>the permissions for you when you push. Seems your ISP has something
>>>>>>>>>>>>>>>set incorrectly.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>No, he was asking how to upload files with PHP - not with FTP.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>--
>>>>>>>>>>>>>>==================
>>>>>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>>>>>==================
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
>>>>>>>>>>>>>chmodding etc.
>>>>>>>>>>>>>So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>>>>>upload it, and
>>>>>>>>>>>>>have the upload script up and running ... ?
>>>>>>>>>>>>>
>>>>>>>>>>>>>Frizzle.
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>Frizzle,
>>>>>>>>>>>>
>>>>>>>>>>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
>>>>>>>>>>>>web server are.
>>>>>>>>>>>>
>>>>>>>>>>>>When you ftp a file to the server, the owner of the file is the userid who
>>>>>>>>>>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
>>>>>>>>>>>>the web server, and the owner is the userid of the server itself.
>>>>>>>>>>>>
>>>>>>>>>>>>--
>>>>>>>>>>>>==================
>>>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>>>==================
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Ok, thanks.
>>>>>>>>>>>Not to go on and on about this, but the other thing i asked is
>>>>>>>>>>>impossible as well then?
>>>>>>>>>>>
>>>>>>>>>>>"So i could mail a zipfile to a client, tell them to unpack it and
>>>>>>>>>>>upload it,
>>>>>>>>>>>and have the upload script up and running ... ?"
>>>>>>>>>>>
>>>>>>>>>>>Frizzle.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>It's easy to ftp or to upload via PHP. Both work quite well (unless the
>>>>>>>>>>server's configuration is screwed up). It's when you try to mix the two you
>>>>>>>>>>start running into permission problems and need to chmod.
>>>>>>>>>>
>>>>>>>>>>--
>>>>>>>>>>==================
>>>>>>>>>>Remove the "x" from my email address
>>>>>>>>>>Jerry Stuckle
>>>>>>>>>>JDS Computer Training Corp.
>>>>>>>>>>js*******@attglobal.net
>>>>>>>>>>==================
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>owkaaaaayyyy, i never realized ftp and uploading aren't the same
>>>>>>>>>thing...
>>>>>>>>>I don't need to mix them, i need a script to upload files, wich can
>>>>>>>>>prefferably
>>>>>>>>>run without any chmodding etc.
>>>>>>>>>
>>>>>>>>>Frizzle.
>>>>>>>>>
>>>>>>>>
>>>>>>>>Ok, you just need to ensure you have the original directory permissions set
>>>>>>>>properly, then. In a typical installation the directory would be owned by the
>>>>>>>>webserver's userid with permissions of 755.
>>>>>>>>
>>>>>>>>And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
>>>>>>>>command. In either case the file ends up on the server. But how it gets there
>>>>>>>>is much different.
>>>>>>>>
>>>>>>>>
>>>>>>>>--
>>>>>>>>==================
>>>>>>>>Remove the "x" from my email address
>>>>>>>>Jerry Stuckle
>>>>>>>>JDS Computer Training Corp.
>>>>>>>>js*******@attglobal.net
>>>>>>>>==================
>>>>>>>
>>>>>>>
>>>>>>>When i create a new folder, either via Plesk, Dreamweaver or WS_FTP,
>>>>>>>folders are standard chmodded 755.
>>>>>>>That should be allright then ...
>>>>>>>
>>>>>>>Frizzle.
>>>>>>>
>>>>>>
>>>>>>*Should be* is the key. If your host has things set ip properly, then yes you
>>>>>>should be OK. But if not...
>>>>>>
>>>>>>And I'm not sure about Plesk, but I know DreamWeaver and WS_FTP both use ftp to
>>>>>>transfer files. I suspect Plesk does, also.
>>>>>>
>>>>>>
>>>>>>--
>>>>>>==================
>>>>>>Remove the "x" from my email address
>>>>>>Jerry Stuckle
>>>>>>JDS Computer Training Corp.
>>>>>>js*******@attglobal.net
>>>>>>==================
>>>>>
>>>>>
>>>>>Well, ok, but where should i focus now to build a script to upload
>>>>>files to my server?
>>>>>FTP, or an other file transfer method?
>>>>>It would be ideal if i could also create / delete folders ...
>>>>>
>>>>>Frizzle.
>>>>>
>>>>
>>>>
>>>>Frizzle,
>>>>
>>>>It depends on how you want to do things. If you're going to be the only one
>>>>uploading, you can do ftp or http uploads. If you have users who may not be
>>>>familiar with ftp, you should do http uploads.
>>>>
>>>>The downside of http uploads is you can't synchronize files between your local
>>>>copy and the website with products like Dreamweaver.
>>>>
>>>>You can create and delete directories in PHP also, assuming your host hasn't
>>>>disabled these functions and you have the appropriate permissions. So that's
>>>>not a problem.
>>>>
>>>>It's all in how you want to maintain your site.
>>>>
>>>>
>>>>--
>>>>==================
>>>>Remove the "x" from my email address
>>>>Jerry Stuckle
>>>>JDS Computer Training Corp.
>>>>js*******@attglobal.net
>>>>==================
>>>
>>>
>>>It's meant for a user based site; users with certain priviledges are
>>>allowed to add news and files to the site. No synchronizing
>>>needed. Mostly images and mp3's, maybe some docs etc.
>>>
>>>Frizzle.
>>>
>>
>>In that case I would suggest http uploads.
>>
>>Maybe the easiest way is to have an admin page where you can let PHP create the
>>root directory(s) you wish, then let the main part of the site upload into these
>>directories and, if necessary, create new directories.
>>
>>If the webserver creates them it will be the owner, also.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>Hmm, hope i'm not back at the start (the chmodding part) i get an
>error:
>
>Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The
>script whose uid is 10008 is not allowed to access / owned by uid 0 in
>/home/httpd/vhosts/host.com/httpdocs/test/admin/ftp2.php on line 17
>
>Here is some more debugging info:Array
>(
> [userfile] => Array
> (
> [name] => photo.jpg
> [type] => image/jpeg
> [tmp_name] => /tmp/phpejdmGr
> [error] => 0
> [size] => 11469
> )
>
>)
>
>
>Does this have something to do with the Chmodding again ? (Please tell
>me it doesn't...)
>
>Frizzle.
>

I have no idea - don't know what code you're using.

But it looks like you're trying to access the system root directory ('/') -
which is owned by root. You can't do it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

You were right, i forgot a dot (shame on me) in the path. My code is
below.
Having fixed that, it gave me the next (of how many :s ) error:

--- ERROR ---

Warning:
move_uploaded_file(/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg):
failed to open stream: Permission denied in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Warning: move_uploaded_file(): Unable to move '/tmp/phpzeJkaC' to
'/home/httpd/vhosts/host.com/httpdocs/new/admin/uploads/photo.jpg' in
/home/httpd/vhosts/host.com/httpdocs/new/admin/ftp2.php on line 17

Possible file upload attack!
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => photo.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpzeJkaC
[error] => 0
[size] => 11469
)

)

--- END ERROR ---

The folder i'm trying to access is /test/admin/uploads
and it does exist. (checked).
I hope you can tel me what's wrong. Anyway, i really appreciate all
your effort for trying to help me!

Frizzle.

My entire exact code is below:

+++++++++++++++++++++++++++++++++++++++++++++ +

<?php

require_once('../inc/globals.php');

/*$ftp_conn = @ftp_connect( $default_ftp_server )or
die('<b>Error!</b><br>FTP Host Niot Found!');
@ftp_login( $ftp_conn, $default_ftp_user, $default_ftp_pass )or
die('<b>Error!</b><br>Wrong FTP-login name or FTP-pass!');

@ftp_close( $ftp_conn );*/

if( isset( $_FILES['userfile'] ) ){
$uploaddir = './uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

};

?>
<form action="<?php echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data" name="images" target="_top" id="images"
class="form">
<input name="userfile" type="file" id="userfile">
<br>
<input type="submit" name="upload" id="upload" value="Upload!">
<input name="cancel" type="button" id="cancel" value="Cancel"
onClick="javascript:if(confirm('Sure?')){ history.go(-1) }else{}">
</form><?php

if (is_dir($uploaddir)) {
if ($dh = opendir($uploaddir)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '..' && $file !== '.') echo "filename: $file : filetype:
" . filetype($uploaddir . $file) . "<br>\r\n";
}
closedir($dh);
}
};

?>

+++++++++++++++++++++++++++++++++++++++++++++ +

OK, who owns the directory, and what are its flags? And what's the userid of
the webserver?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

User: domainname
Group: psacln
Permissions: rwx r-x r-x

Userid i don't know. How could i check that ?

Frizzle.


Well, the Apache user is usually (but not always) the owner of the document root
directory. Or you can ask your webhost.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 11 '06 #27
try to change the temp directory to own buy your user. Your /tmp
directory maybe secured so php has a hard time putting files there.

--
Mike
http://www.xpertdns.com

Apr 12 '06 #28
I asked my webhost, but they told me uploading
a folder and having it running uploads etc. is not
possible on Linux by default. Folders should be
chmod 777 or chmod 755.

Frizzle.

Apr 14 '06 #29
frizzle wrote:
I asked my webhost, but they told me uploading
a folder and having it running uploads etc. is not
possible on Linux by default. Folders should be
chmod 777 or chmod 755.

Frizzle.


Yes and no. It depends on how they have their folders configured.

However, obviously they have it configured so you can't do it. But you should
still be able to create the folder in PHP from a web page (so it's running as
the Apache user) and upload to it. The folder should then have the Apache user
as the owner.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 14 '06 #30
Jerry Stuckle wrote:
frizzle wrote:
I asked my webhost, but they told me uploading
a folder and having it running uploads etc. is not
possible on Linux by default. Folders should be
chmod 777 or chmod 755.

Frizzle.


Yes and no. It depends on how they have their folders configured.

However, obviously they have it configured so you can't do it. But you should
still be able to create the folder in PHP from a web page (so it's running as
the Apache user) and upload to it. The folder should then have the Apache user
as the owner.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


AFAIK the script below should be able to create dirs then
but i get the following error:

Warning: mkdir(testdir): Permission denied in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 5

Warning: Cannot modify header information - headers already sent by
(output started at
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php:5) in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 6

Frizzle.

++++++++++++++++++++++++++++++++++++++++++++++++++ +

<?php

if(isset( $_POST['dir'] ))
{
mkdir( $_POST['dir'], 0755 );
header('Location: '.$PHP_SELF);
};
?><form action="<?php echo $PHP_SELF; ?>" method="post"
name="mkdirtest" target="_top" id="mkdirtest">
<label for="dir">dir</label>
<input type="text" name="dir" id="dir"<?php echo isset( $_POST['dir']
) ? ' value="'.$_POST['dir'].'"' : '' ?>>
<label for="Submit"></label>
<input type="submit" name="Submit" value="mkdir!" id="Submit">
</form><?php

$handle = opendir('.');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
echo $file.'<br>';
};
};

closedir( $handle );

?>

Apr 14 '06 #31
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
I asked my webhost, but they told me uploading
a folder and having it running uploads etc. is not
possible on Linux by default. Folders should be
chmod 777 or chmod 755.

Frizzle.


Yes and no. It depends on how they have their folders configured.

However, obviously they have it configured so you can't do it. But you should
still be able to create the folder in PHP from a web page (so it's running as
the Apache user) and upload to it. The folder should then have the Apache user
as the owner.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

AFAIK the script below should be able to create dirs then
but i get the following error:

Warning: mkdir(testdir): Permission denied in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 5

Warning: Cannot modify header information - headers already sent by
(output started at
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php:5) in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 6

Frizzle.

++++++++++++++++++++++++++++++++++++++++++++++++++ +

<?php

if(isset( $_POST['dir'] ))
{
mkdir( $_POST['dir'], 0755 );
header('Location: '.$PHP_SELF);
};
?><form action="<?php echo $PHP_SELF; ?>" method="post"
name="mkdirtest" target="_top" id="mkdirtest">
<label for="dir">dir</label>
<input type="text" name="dir" id="dir"<?php echo isset( $_POST['dir']
) ? ' value="'.$_POST['dir'].'"' : '' ?>>
<label for="Submit"></label>
<input type="submit" name="Submit" value="mkdir!" id="Submit">
</form><?php

$handle = opendir('.');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
echo $file.'<br>';
};
};

closedir( $handle );

?>


What happens if you leave off the 0755? That may be restricted in your
location. Just try it with the default.

If it still doesn't work, looks like it's time to find another host. This one
has too many restrictions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 15 '06 #32

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

I asked my webhost, but they told me uploading
a folder and having it running uploads etc. is not
possible on Linux by default. Folders should be
chmod 777 or chmod 755.

Frizzle.
Yes and no. It depends on how they have their folders configured.

However, obviously they have it configured so you can't do it. But you should
still be able to create the folder in PHP from a web page (so it's running as
the Apache user) and upload to it. The folder should then have the Apache user
as the owner.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

AFAIK the script below should be able to create dirs then
but i get the following error:

Warning: mkdir(testdir): Permission denied in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 5

Warning: Cannot modify header information - headers already sent by
(output started at
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php:5) in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 6

Frizzle.

++++++++++++++++++++++++++++++++++++++++++++++++++ +

<?php

if(isset( $_POST['dir'] ))
{
mkdir( $_POST['dir'], 0755 );
header('Location: '.$PHP_SELF);
};
?><form action="<?php echo $PHP_SELF; ?>" method="post"
name="mkdirtest" target="_top" id="mkdirtest">
<label for="dir">dir</label>
<input type="text" name="dir" id="dir"<?php echo isset( $_POST['dir']
) ? ' value="'.$_POST['dir'].'"' : '' ?>>
<label for="Submit"></label>
<input type="submit" name="Submit" value="mkdir!" id="Submit">
</form><?php

$handle = opendir('.');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
echo $file.'<br>';
};
};

closedir( $handle );

?>


What happens if you leave off the 0755? That may be restricted in your
location. Just try it with the default.

If it still doesn't work, looks like it's time to find another host. This one
has too many restrictions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Hmm, that's really crap. 755 does nothing more, and changing hosts
isn't really an option. ... :(

Frizzle.

Apr 17 '06 #33
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>I asked my webhost, but they told me uploading
>a folder and having it running uploads etc. is not
>possible on Linux by default. Folders should be
>chmod 777 or chmod 755.
>
>Frizzle.
>

Yes and no. It depends on how they have their folders configured.

However, obviously they have it configured so you can't do it. But you should
still be able to create the folder in PHP from a web page (so it's running as
the Apache user) and upload to it. The folder should then have the Apache user
as the owner.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
AFAIK the script below should be able to create dirs then
but i get the following error:

Warning: mkdir(testdir): Permission denied in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 5

Warning: Cannot modify header information - headers already sent by
(output started at
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php:5) in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 6

Frizzle.

+++++++++++++++++++++++++++++++++++++++++++++++ ++++

<?php

if(isset( $_POST['dir'] ))
{
mkdir( $_POST['dir'], 0755 );
header('Location: '.$PHP_SELF);
};
?><form action="<?php echo $PHP_SELF; ?>" method="post"
name="mkdirtest" target="_top" id="mkdirtest">
<label for="dir">dir</label>
<input type="text" name="dir" id="dir"<?php echo isset( $_POST['dir']
) ? ' value="'.$_POST['dir'].'"' : '' ?>>
<label for="Submit"></label>
<input type="submit" name="Submit" value="mkdir!" id="Submit">
</form><?php

$handle = opendir('.');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
echo $file.'<br>';
};
};

closedir( $handle );

?>

What happens if you leave off the 0755? That may be restricted in your
location. Just try it with the default.

If it still doesn't work, looks like it's time to find another host. This one
has too many restrictions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Hmm, that's really crap. 755 does nothing more, and changing hosts
isn't really an option. ... :(

Frizzle.


But unfortunately, it looks like your host has too many things locked down for
you to be able to upload files through the website.

I can partially understand their reasoning in a shared environment. But at the
same time, other hosting companies can do it. So why can't they?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 17 '06 #34
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>I asked my webhost, but they told me uploading
>>a folder and having it running uploads etc. is not
>>possible on Linux by default. Folders should be
>>chmod 777 or chmod 755.
>>
>>Frizzle.
>>
>
>Yes and no. It depends on how they have their folders configured.
>
>However, obviously they have it configured so you can't do it. But you should
>still be able to create the folder in PHP from a web page (so it's running as
>the Apache user) and upload to it. The folder should then have the Apache user
>as the owner.
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
AFAIK the script below should be able to create dirs then
but i get the following error:

Warning: mkdir(testdir): Permission denied in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 5

Warning: Cannot modify header information - headers already sent by
(output started at
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php:5) in
/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 6

Frizzle.

+++++++++++++++++++++++++++++++++++++++++++++++ ++++

<?php

if(isset( $_POST['dir'] ))
{
mkdir( $_POST['dir'], 0755 );
header('Location: '.$PHP_SELF);
};
?><form action="<?php echo $PHP_SELF; ?>" method="post"
name="mkdirtest" target="_top" id="mkdirtest">
<label for="dir">dir</label>
<input type="text" name="dir" id="dir"<?php echo isset( $_POST['dir']
) ? ' value="'.$_POST['dir'].'"' : '' ?>>
<label for="Submit"></label>
<input type="submit" name="Submit" value="mkdir!" id="Submit">
</form><?php

$handle = opendir('.');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
echo $file.'<br>';
};
};

closedir( $handle );

?>

What happens if you leave off the 0755? That may be restricted in your
location. Just try it with the default.

If it still doesn't work, looks like it's time to find another host. This one
has too many restrictions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Hmm, that's really crap. 755 does nothing more, and changing hosts
isn't really an option. ... :(

Frizzle.


But unfortunately, it looks like your host has too many things locked down for
you to be able to upload files through the website.

I can partially understand their reasoning in a shared environment. But at the
same time, other hosting companies can do it. So why can't they?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


I guess you're right, but i really really don't want to change hosts. I
have multiple
sites hosted there, knowing their service etc. is great. (And still is)
This is the
first kind of problem i've come across.

I mailed them with my problem, and saying i don't want to swich, and if
they can
come up with another solution. If not, then i'll see ...

I looked into another old site on one of their servers wich was meant
as an online
diary with a photo gallery. I created an upload-module for photos.
These were
automatically resized by PHP. Looking through Plesk's file manager, i
can see the
folder the pics end up in is chmodded rwx r-x r-x (755), pics are rw-
r-- r-- (644)

Pics and folder have the same owner, and belong to the same group. Pics
are as
i said PHP created, the folder was done in dreamweaver, but probably
chmodded
manually. I wonder if this is possible for other files then images,
because they
don't have to be resampled, so aren't actually created by PHP.

I hope you get what i'm saying.

Frizzle.

Apr 18 '06 #35
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
>Jerry Stuckle wrote:
>
>
>
>>frizzle wrote:
>>
>>
>>
>>>I asked my webhost, but they told me uploading
>>>a folder and having it running uploads etc. is not
>>>possible on Linux by default. Folders should be
>>>chmod 777 or chmod 755.
>>>
>>>Frizzle.
>>>
>>
>>Yes and no. It depends on how they have their folders configured.
>>
>>However, obviously they have it configured so you can't do it. But you should
>>still be able to create the folder in PHP from a web page (so it's running as
>>the Apache user) and upload to it. The folder should then have the Apache user
>>as the owner.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>js*******@attglobal.net
>>==================
>
>
>AFAIK the script below should be able to create dirs then
>but i get the following error:
>
>Warning: mkdir(testdir): Permission denied in
>/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 5
>
>Warning: Cannot modify header information - headers already sent by
>(output started at
>/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php:5) in
>/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 6
>
>Frizzle.
>
>+++++++++++++++++++++++++++++++++++++++++++++ ++++++
>
><?php
>
> if(isset( $_POST['dir'] ))
> {
> mkdir( $_POST['dir'], 0755 );
> header('Location: '.$PHP_SELF);
> };
>
>
>?><form action="<?php echo $PHP_SELF; ?>" method="post"
>name="mkdirtest" target="_top" id="mkdirtest">
> <label for="dir">dir</label>
> <input type="text" name="dir" id="dir"<?php echo isset( $_POST['dir']
>) ? ' value="'.$_POST['dir'].'"' : '' ?>>
> <label for="Submit"></label>
> <input type="submit" name="Submit" value="mkdir!" id="Submit">
></form><?php
>
>$handle = opendir('.');
>
>while (false !== ($file = readdir($handle))) {
> if ($file != "." && $file != ".." ) {
> echo $file.'<br>';
> };
>};
>
>closedir( $handle );
>
>?>
>
What happens if you leave off the 0755? That may be restricted in your
location. Just try it with the default.

If it still doesn't work, looks like it's time to find another host. This one
has too many restrictions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Hmm, that's really crap. 755 does nothing more, and changing hosts
isn't really an option. ... :(

Frizzle.


But unfortunately, it looks like your host has too many things locked down for
you to be able to upload files through the website.

I can partially understand their reasoning in a shared environment. But at the
same time, other hosting companies can do it. So why can't they?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

I guess you're right, but i really really don't want to change hosts. I
have multiple
sites hosted there, knowing their service etc. is great. (And still is)
This is the
first kind of problem i've come across.

I mailed them with my problem, and saying i don't want to swich, and if
they can
come up with another solution. If not, then i'll see ...

I looked into another old site on one of their servers wich was meant
as an online
diary with a photo gallery. I created an upload-module for photos.
These were
automatically resized by PHP. Looking through Plesk's file manager, i
can see the
folder the pics end up in is chmodded rwx r-x r-x (755), pics are rw-
r-- r-- (644)

Pics and folder have the same owner, and belong to the same group. Pics
are as
i said PHP created, the folder was done in dreamweaver, but probably
chmodded
manually. I wonder if this is possible for other files then images,
because they
don't have to be resampled, so aren't actually created by PHP.

I hope you get what i'm saying.

Frizzle.


Yes, I see what you're saying. However, I don't think it should make a
difference like you think. Whether it's an image that's been sampled or a file
that's been uploaded, the Apache userid is doing the work.

The difference I can see is that the move_uploaded_files probably calls a system
function to actually move the files (don't know - I haven't looked). Obviously
the pix site doesn't do this when it resizes the pix; don't know what it does
before that, though.

the other possibility is they have the other server configured differently -
either PHP or the OS (or both). phpinfo() could tell you if there are PHP
differences.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 18 '06 #36
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

Jerry Stuckle wrote:
>frizzle wrote:
>
>
>>Jerry Stuckle wrote:
>>
>>
>>
>>>frizzle wrote:
>>>
>>>
>>>
>>>>I asked my webhost, but they told me uploading
>>>>a folder and having it running uploads etc. is not
>>>>possible on Linux by default. Folders should be
>>>>chmod 777 or chmod 755.
>>>>
>>>>Frizzle.
>>>>
>>>
>>>Yes and no. It depends on how they have their folders configured.
>>>
>>>However, obviously they have it configured so you can't do it. But you should
>>>still be able to create the folder in PHP from a web page (so it's running as
>>>the Apache user) and upload to it. The folder should then have the Apache user
>>>as the owner.
>>>
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>js*******@attglobal.net
>>>==================
>>
>>
>>AFAIK the script below should be able to create dirs then
>>but i get the following error:
>>
>>Warning: mkdir(testdir): Permission denied in
>>/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 5
>>
>>Warning: Cannot modify header information - headers already sent by
>>(output started at
>>/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php:5) in
>>/usr/local/psa/home/vhosts/host.com/httpdocs/test/mkdir.php on line 6
>>
>>Frizzle.
>>
>>+++++++++++++++++++++++++++++++++++++++++++++ ++++++
>>
>><?php
>>
>> if(isset( $_POST['dir'] ))
>> {
>> mkdir( $_POST['dir'], 0755 );
>> header('Location: '.$PHP_SELF);
>> };
>>
>>
>>?><form action="<?php echo $PHP_SELF; ?>" method="post"
>>name="mkdirtest" target="_top" id="mkdirtest">
>> <label for="dir">dir</label>
>> <input type="text" name="dir" id="dir"<?php echo isset( $_POST['dir']
>>) ? ' value="'.$_POST['dir'].'"' : '' ?>>
>> <label for="Submit"></label>
>> <input type="submit" name="Submit" value="mkdir!" id="Submit">
>></form><?php
>>
>>$handle = opendir('.');
>>
>>while (false !== ($file = readdir($handle))) {
>> if ($file != "." && $file != ".." ) {
>> echo $file.'<br>';
>> };
>>};
>>
>>closedir( $handle );
>>
>>?>
>>
>What happens if you leave off the 0755? That may be restricted in your
>location. Just try it with the default.
>
>If it still doesn't work, looks like it's time to find another host. This one
>has too many restrictions.
>
>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>js*******@attglobal.net
>==================
Hmm, that's really crap. 755 does nothing more, and changing hosts
isn't really an option. ... :(

Frizzle.
But unfortunately, it looks like your host has too many things locked down for
you to be able to upload files through the website.

I can partially understand their reasoning in a shared environment. But at the
same time, other hosting companies can do it. So why can't they?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

I guess you're right, but i really really don't want to change hosts. I
have multiple
sites hosted there, knowing their service etc. is great. (And still is)
This is the
first kind of problem i've come across.

I mailed them with my problem, and saying i don't want to swich, and if
they can
come up with another solution. If not, then i'll see ...

I looked into another old site on one of their servers wich was meant
as an online
diary with a photo gallery. I created an upload-module for photos.
These were
automatically resized by PHP. Looking through Plesk's file manager, i
can see the
folder the pics end up in is chmodded rwx r-x r-x (755), pics are rw-
r-- r-- (644)

Pics and folder have the same owner, and belong to the same group. Pics
are as
i said PHP created, the folder was done in dreamweaver, but probably
chmodded
manually. I wonder if this is possible for other files then images,
because they
don't have to be resampled, so aren't actually created by PHP.

I hope you get what i'm saying.

Frizzle.


Yes, I see what you're saying. However, I don't think it should make a
difference like you think. Whether it's an image that's been sampled or a file
that's been uploaded, the Apache userid is doing the work.

The difference I can see is that the move_uploaded_files probably calls a system
function to actually move the files (don't know - I haven't looked). Obviously
the pix site doesn't do this when it resizes the pix; don't know what it does
before that, though.

the other possibility is they have the other server configured differently -
either PHP or the OS (or both). phpinfo() could tell you if there are PHP
differences.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


PHP & OS are similar.
My upload function is below.
Hope it can get me/you any further ...
(again, really thanks for all the help!!)

Frizzle.

******* C O D E - A L E R T ! ! ! ************************
<?php

function ResizeUpload( $this_uploaded_image )
{

global $album_id; // id of album where pic should end up in
global $conn_id;

$maxSize = 500;

$tmp_image = imagecreatefromjpeg($this_uploaded_image);
$width = imagesx($tmp_image);
$height = imagesy($tmp_image);

$maxSide = ( $width > $height ) ? $width : $height;

if ($maxSide > $maxSize)
{
$ratio = $maxSize / $maxSide;
$new_width = round( $width * $ratio, 0 );
$new_height = round( $height * $ratio, 0 );
}
else
{
$new_width = $width;
$new_height = $height;
};

$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresized($new_image, $tmp_image, 0, 0, 0, 0, $new_width,
$new_height, $width, $height);

//Grab new image
ob_start();
imagejpeg($new_image, '', 90);
$image_buffer = ob_get_contents();
ob_end_clean();
imagedestroy($new_image);

//Create temporary file and write to it
$fp = tmpfile();
fwrite($fp, $image_buffer);
rewind($fp);

$created = date("YmdHis");

$addpic = mysql_query("INSERT INTO photos (album_id) VALUES
($album_id)") or die(mysql_error());
$this_image_name= substr('0000000000'.mysql_insert_id(), -10, 10);

//Upload new image
if(ftp_fput($conn_id,'/httpdocs/img/photos/'.$this_image_name.'.jpg',
$fp, FTP_BINARY))
{

$_SESSION['UploadedPics'] += 1;

}
else
{

$error_reporting += 1;

};

fclose($fp);
};
$conn_id = ftp_connect('ftp.host.com');
ftp_login( $conn_id, 'loginname', 'pass')or die('Error :( ');

ResizeUpload($_FILES['image']['tmp_name'] );

ftp_close($conn_id);

?>

Apr 18 '06 #37
frizzle wrote:
<old posts snipped>


PHP & OS are similar.
My upload function is below.
Hope it can get me/you any further ...
(again, really thanks for all the help!!)

Frizzle.


<code snipped>

Sorry for the delay - I missed this one when you posted earlier in the week.

Well, it isn't how I would have done it, but it should work.

First thing I would have done was to move the uploaded file from the temp
directory a working directory (move_uploaded_file() ). This gets it completely
out of the temporary director (which could be something like /tmp) where there
may be limitations on what you can do with it.

Then I'd do the resizing or whatever I need in my workarea.

I'm also not sure why you're ftping back to yourself (at least I assume it's
yourself). Why not just store the file where you want it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 23 '06 #38

Jerry Stuckle wrote:
frizzle wrote:
<old posts snipped>


PHP & OS are similar.
My upload function is below.
Hope it can get me/you any further ...
(again, really thanks for all the help!!)

Frizzle.


<code snipped>

Sorry for the delay - I missed this one when you posted earlier in the week.

Well, it isn't how I would have done it, but it should work.

First thing I would have done was to move the uploaded file from the temp
directory a working directory (move_uploaded_file() ). This gets it completely
out of the temporary director (which could be something like /tmp) where there
may be limitations on what you can do with it.

Then I'd do the resizing or whatever I need in my workarea.

I'm also not sure why you're ftping back to yourself (at least I assume it's
yourself). Why not just store the file where you want it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


No problem with the delay, i was only hoping your last message hadn't
been sent. And luckily it hasn't.

Erm, this is an adjusted script of something i found somewhere.
I wouldn't know how to store it where i want ... :$ Shame on me.
I only have relative little time during the weeks to dig into PHP :(
Is there something you could point to me ( a script, preferrably
w/o classes)?

Frizzle.

Apr 24 '06 #39
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
<old posts snipped>

PHP & OS are similar.
My upload function is below.
Hope it can get me/you any further ...
(again, really thanks for all the help!!)

Frizzle.


<code snipped>

Sorry for the delay - I missed this one when you posted earlier in the week.

Well, it isn't how I would have done it, but it should work.

First thing I would have done was to move the uploaded file from the temp
directory a working directory (move_uploaded_file() ). This gets it completely
out of the temporary director (which could be something like /tmp) where there
may be limitations on what you can do with it.

Then I'd do the resizing or whatever I need in my workarea.

I'm also not sure why you're ftping back to yourself (at least I assume it's
yourself). Why not just store the file where you want it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

No problem with the delay, i was only hoping your last message hadn't
been sent. And luckily it hasn't.

Erm, this is an adjusted script of something i found somewhere.
I wouldn't know how to store it where i want ... :$ Shame on me.
I only have relative little time during the weeks to dig into PHP :(
Is there something you could point to me ( a script, preferrably
w/o classes)?

Frizzle.


Not really. When I need something like this I just code it up. But they're
typically special purpose and would need changing for your system.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 24 '06 #40
> If the php application created it, the owner will be the user running the
application - in the case of a web application, it would be the webserver's
userid.


Which may be your userid, which may be the userid you use for ftp.

Apr 24 '06 #41

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
<old posts snipped>
PHP & OS are similar.
My upload function is below.
Hope it can get me/you any further ...
(again, really thanks for all the help!!)

Frizzle.
<code snipped>

Sorry for the delay - I missed this one when you posted earlier in the week.

Well, it isn't how I would have done it, but it should work.

First thing I would have done was to move the uploaded file from the temp
directory a working directory (move_uploaded_file() ). This gets it completely
out of the temporary director (which could be something like /tmp) where there
may be limitations on what you can do with it.

Then I'd do the resizing or whatever I need in my workarea.

I'm also not sure why you're ftping back to yourself (at least I assume it's
yourself). Why not just store the file where you want it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

No problem with the delay, i was only hoping your last message hadn't
been sent. And luckily it hasn't.

Erm, this is an adjusted script of something i found somewhere.
I wouldn't know how to store it where i want ... :$ Shame on me.
I only have relative little time during the weeks to dig into PHP :(
Is there something you could point to me ( a script, preferrably
w/o classes)?

Frizzle.


Not really. When I need something like this I just code it up. But they're
typically special purpose and would need changing for your system.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Jerry, is there any possiblity for you e.g. to point me in a certain
direction? As you
said, you would've done it differently ...

Frizzle.

Apr 24 '06 #42
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
<old posts snipped>

>PHP & OS are similar.
>My upload function is below.
>Hope it can get me/you any further ...
>(again, really thanks for all the help!!)
>
>Frizzle.
>

<code snipped>

Sorry for the delay - I missed this one when you posted earlier in the week.

Well, it isn't how I would have done it, but it should work.

First thing I would have done was to move the uploaded file from the temp
directory a working directory (move_uploaded_file() ). This gets it completely
out of the temporary director (which could be something like /tmp) where there
may be limitations on what you can do with it.

Then I'd do the resizing or whatever I need in my workarea.

I'm also not sure why you're ftping back to yourself (at least I assume it's
yourself). Why not just store the file where you want it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
No problem with the delay, i was only hoping your last message hadn't
been sent. And luckily it hasn't.

Erm, this is an adjusted script of something i found somewhere.
I wouldn't know how to store it where i want ... :$ Shame on me.
I only have relative little time during the weeks to dig into PHP :(
Is there something you could point to me ( a script, preferrably
w/o classes)?

Frizzle.


Not really. When I need something like this I just code it up. But they're
typically special purpose and would need changing for your system.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jerry, is there any possiblity for you e.g. to point me in a certain
direction? As you
said, you would've done it differently ...

Frizzle.


Yes, to start I'd move it from the temporary directory with
move_uploaded_file(). Then I'd do my work on it and write it directly to the
filesystem with the file functions such as fopen(), etc.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 24 '06 #43
fletch wrote:
If the php application created it, the owner will be the user running the
application - in the case of a web application, it would be the webserver's
userid.

Which may be your userid, which may be the userid you use for ftp.


In that case the PHP application didn't create it. FTP did. It may have been
driven by the PHP application, but it's not the application working directly on
the filesystem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 24 '06 #44
>> Which may be your userid, which may be the userid you use for ftp.

In that case the PHP application didn't create it. FTP did. It may have been
driven by the PHP application, but it's not the application working directly on
the filesystem.
I should be clearer. Apache can run with suExec, and often does in a
shared hosting environment. This means that the particular apache
process which runs a script runs with the uid and gid of that script.
The host will then ensure that the files in the user's directory have
the correct uid and gid bits set. This means that the uid of an ftp'd
file and a file created by php run through apache will be the same.

Just a foot note to the main point of the thread.
From http://httpd.apache.org/docs/1.3/suexec.html The suEXEC feature -- introduced in Apache 1.2 -- provides Apache users the ability to run CGI and
SSI programs under user IDs different from the user ID of the calling web-server. Normally, when a
CGI or SSI program executes, it runs as the same user who is running the web server.

Used properly, this feature can reduce considerably the security risks involved with allowing users
to develop and run private CGI or SSI programs. However, if suEXEC is improperly configured, it
can cause any number of problems and possibly create new holes in your computer's security. If
you aren't familiar with managing setuid root programs and the security issues they present, we
highly recommend that you not consider using suEXEC.


Apr 24 '06 #45
fletch wrote:
Which may be your userid, which may be the userid you use for ftp.


In that case the PHP application didn't create it. FTP did. It may have been
driven by the PHP application, but it's not the application working directly on
the filesystem.

I should be clearer. Apache can run with suExec, and often does in a
shared hosting environment. This means that the particular apache
process which runs a script runs with the uid and gid of that script.
The host will then ensure that the files in the user's directory have
the correct uid and gid bits set. This means that the uid of an ftp'd
file and a file created by php run through apache will be the same.

Just a foot note to the main point of the thread.
From http://httpd.apache.org/docs/1.3/suexec.html


The suEXEC feature -- introduced in Apache 1.2 -- provides Apache users the ability to run CGI and
SSI programs under user IDs different from the user ID of the calling web-server. Normally, when a
CGI or SSI program executes, it runs as the same user who is running the web server.

Used properly, this feature can reduce considerably the security risks involved with allowing users
to develop and run private CGI or SSI programs. However, if suEXEC is improperly configured, it
can cause any number of problems and possibly create new holes in your computer's security. If
you aren't familiar with managing setuid root programs and the security issues they present, we
highly recommend that you not consider using suEXEC.



Thanks for the info, Fletch. I knew there was something different about SuEXEC,
but wasn't sure what it was.

So he may need to either chown the scripts to the Apache process owner, or
create the directories with the same owner as the script?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 24 '06 #46
> So he may need to either chown the scripts to the Apache process owner, or
create the directories with the same owner as the script?


I think so yes.

Apr 25 '06 #47
fletch wrote:
So he may need to either chown the scripts to the Apache process owner, or
create the directories with the same owner as the script?

I think so yes.


OK, that makes sense then. Thanks again for the info!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 25 '06 #48

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Daniel | last post by:
Hi, From what I read from the PHP manual, chmod on a Windows platform should have no effect, and that seems totally normal (unless someone on sourceforge has a windows port of that!). I...
6
by: Ask Josephsen | last post by:
Hi NG If I write the following: <?php $file="myfile.JPG"; if ( getmyuid()==fileowner ( $file ) ) { chgrp ( $file, getmygid() ); chown ( $file, getmyuid() );
1
by: Xuan Yuan | last post by:
I'm using Windows XP Professional and have no FTP installed. Instead, I use Command Promt. I need to CHMOD a PHP file, so I type "CHMOD 775 file-path",but get "'CHMOD'is not recognized as an internal...
4
by: Ian N | last post by:
Hi i'm having a problem with file permissions of upload, they appear to be being set to only readable by the administrator, so anyone browsing the site gets a 403 forbidden error when they try and...
5
by: Stewart | last post by:
Hi, I'm working on a program in VC++ right now that needs to set file permissions of a given file to 766 (read/write/execute). Now I've found the _chmod() function in the API help docs, but that...
2
by: Freebird | last post by:
Hello everyone, =] I need your help, I'm creating a script that will work in many servers, and there's this part, where you can update a list, so the script goes from the client's machine to...
1
by: James Colannino | last post by:
Ok, so now I have a very interesting problem, this time related to os.chmod. I have the following in a text file: 0600. My script reads that number as a string and converts it to an integer for...
3
by: webhead | last post by:
I have a web where users can upload photos, but they want to also be able to delete them. The directory can have chmod changes but it won't let me chmod the files and unlink them. I'm assuming it...
3
by: Rik | last post by:
Hello, first of all, my provider sucks, newsserver is down for the #nth time now, offcourse when I have an urgent question.... So this will be me first time using Google Groups, forgive me if...
1
by: lawrence k | last post by:
I've a simple script to transfer some files from one domain to another, with both domains living on the same server. The files in both directories are already chmod 777. Yet after transfer, I try...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.