Re: [PHP] file uploads problem

2002-09-24 Thread @ Edwin
Just a comment...

On Tuesday, September 24, 2002 1:39 PM
Jaski wrote:
snip
 I tried to copy this file using
 move_uploaded_file($userfile, "/place/to/put/uploaded/file");

 and here a strange thing happened. The file was successfully
 copied BUT it had permissions like -rw-- which I interpret as
 only accessible to root. I tried copy() function instead and it
 failed.


...having that "permission" doesn't necessarily mean that it's only
accessible to root--unless of course you're running Apache as root, which I
doubt you'd do.

Anyway, if the file was successfully copied why not just try to open it
there?

- E

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


Re: Re: [PHP] file uploads problem

2002-09-24 Thread Jaski

No Edwin .. I can't do any thing to that file .. not even from my 
ftp client .. can't download can't change permissions ..

The server is managed by rackspace .. I doubt they would do some 
thing like running apache as root which I hear is a v foolish 
thing to do  (frankly I don't know how to figure it out myself 
..if that is the case .. phpinfo() did not say any thing on 
that.)

A brief restatement of problem

File uploaded via HTTP POST to /tmp  OK

After this I tried the following three things and none worked.

a) fopen(/tmp/temp_file_name,rb)  FAILED (Operation not 
permitted)
b) copy($tempfile, /place/to/put/uploaded/file) FAILED
c) move_uploaded_file($userfile, /place/to/put/uploaded/file) 
DID COPY BUT file had -rw permissions, and could not open 
this file either... so back to square 1

The directory in /place/to/put/uploaded/file is mode 777 .


Still fighting it out.
Regards
Jaski



On Tue, 24 Sep 2002  Edwin wrote :
Just a comment...

On Tuesday, September 24, 2002 1:39 PM
Jaski wrote:
snip
  I tried to copy this file using
  move_uploaded_file($userfile, 
/place/to/put/uploaded/file);
 
  and here a strange thing happened. The file was successfully
  copied BUT it had permissions like -rw-- which I interpret 
as
  only accessible to root. I tried copy() function instead and 
it
  failed.
 

...having that permission doesn't necessarily mean that it's 
only
accessible to root--unless of course you're running Apache as 
root, which I
doubt you'd do.

Anyway, if the file was successfully copied why not just try to 
open it
there?

- E


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




Re: [PHP] file uploads problem

2002-09-24 Thread Marek Kilimajer

What I don't understand is how can your webserver create a file and then 
not to have permission to read it.
What is your setup?

Jaski wrote:

 No Edwin .. I can't do any thing to that file .. not even from my ftp 
 client .. can't download can't change permissions ..

 The server is managed by rackspace .. I doubt they would do some thing 
 like running apache as root which I hear is a v foolish thing to do  
 (frankly I don't know how to figure it out myself ..if that is the 
 case .. phpinfo() did not say any thing on that.)

 A brief restatement of problem

 File uploaded via HTTP POST to /tmp  OK

 After this I tried the following three things and none worked.

 a) fopen(/tmp/temp_file_name,rb)  FAILED (Operation not permitted)
 b) copy($tempfile, /place/to/put/uploaded/file) FAILED
 c) move_uploaded_file($userfile, /place/to/put/uploaded/file) DID 
 COPY BUT file had -rw permissions, and could not open this 
 file either... so back to square 1

 The directory in /place/to/put/uploaded/file is mode 777 .


 Still fighting it out.
 Regards
 Jaski



 On Tue, 24 Sep 2002 @ Edwin wrote :

 Just a comment...

 On Tuesday, September 24, 2002 1:39 PM
 Jaski wrote:
 snip
  I tried to copy this file using
  move_uploaded_file($userfile, /place/to/put/uploaded/file);
 
  and here a strange thing happened. The file was successfully
  copied BUT it had permissions like -rw-- which I interpret as
  only accessible to root. I tried copy() function instead and it
  failed.
 

 ...having that permission doesn't necessarily mean that it's only
 accessible to root--unless of course you're running Apache as root, 
 which I
 doubt you'd do.

 Anyway, if the file was successfully copied why not just try to open it
 there?

 - E





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




Re: Re: [PHP] file uploads problem

2002-09-24 Thread @ Edwin
Jaski,

On Tuesday, September 24, 2002 5:07 PM
Jaski wrote:
 No Edwin .. I can't do any thing to that file .. not even from my
 ftp client .. can't download can't change permissions ..


I think you won't be able to do anything with the file IF you use your ftp
client. The reason is because *you* don't own the file so you can't read it
nor change it's permissions. Your *script(s)* owns the file so most probably
if you use another script to read and change the permissions, the script
would be able to do it. In other words, use your php script to read and
change the permissions. Perhaps, you'd like to play with these functions and
see what's happening...

  http://www.php.net/manual/en/function.is-readable.php
  http://www.php.net/manual/en/function.fileperms.php
  http://www.php.net/manual/en/function.chown.php

Of course, there's a lot more others under

  http://www.php.net/manual/en/ref.filesystem.php

HTH,

- E

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


Re: Re: [PHP] file uploads problem

2002-09-24 Thread @ Edwin
Oops, what I wanted to post was

  http://www.php.net/manual/en/function.chmod.php

and not

  http://www.php.net/manual/en/function.chown.php

- E

On Tuesday, September 24, 2002 6:00 PM
@ Edwin wrote:

 Jaski,

 On Tuesday, September 24, 2002 5:07 PM
 Jaski wrote:
  No Edwin .. I can't do any thing to that file .. not even from my
  ftp client .. can't download can't change permissions ..
 

 I think you won't be able to do anything with the file IF you use your ftp
 client. The reason is because *you* don't own the file so you can't read
it
 nor change it's permissions. Your *script(s)* owns the file so most
probably
 if you use another script to read and change the permissions, the script
 would be able to do it. In other words, use your php script to read and
 change the permissions. Perhaps, you'd like to play with these functions
and
 see what's happening...

   http://www.php.net/manual/en/function.is-readable.php
   http://www.php.net/manual/en/function.fileperms.php
   http://www.php.net/manual/en/function.chown.php

 Of course, there's a lot more others under

   http://www.php.net/manual/en/ref.filesystem.php

 HTH,

 - E

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


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


Re: Re: Re: [PHP] file uploads problem

2002-09-24 Thread Jaski

Thanks Edwin .. this one was Bang On. It was exactly what you said 
.. and now it works .. thanks a lot.

Jaski

On Tue, 24 Sep 2002  Edwin wrote :
Jaski,

On Tuesday, September 24, 2002 5:07 PM
Jaski wrote:
  No Edwin .. I can't do any thing to that file .. not even from 
my
  ftp client .. can't download can't change permissions ..
 

I think you won't be able to do anything with the file IF you use 
your ftp
client. The reason is because *you* don't own the file so you 
can't read it
nor change it's permissions. Your *script(s)* owns the file so 
most probably
if you use another script to read and change the permissions, the 
script
would be able to do it. In other words, use your php script to 
read and
change the permissions. Perhaps, you'd like to play with these 
functions and
see what's happening...

   http://www.php.net/manual/en/function.is-readable.php
   http://www.php.net/manual/en/function.fileperms.php
   http://www.php.net/manual/en/function.chown.php

Of course, there's a lot more others under

   http://www.php.net/manual/en/ref.filesystem.php

HTH,

- E


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




[PHP] file uploads problem

2002-09-23 Thread Jaski

Hi,
(Linux RH 7.1, Apache/1.3.22, PHP 4.0.6).

I am trying to write a script to send emails. It needs to support 
attachments. The point where I am stuck is after the file to be 
attached gets uploaded to /tmp as /tmp/tempfilename thorough an 
HTTP POST form.

I am not able to open that file directly .. follwing error shows 
up.

Warning: fopen(/tmp/phpOaILXx,rb) - Operation not
permitted in
/var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php
on line 254


I tried to copy this file using
move_uploaded_file($userfile, /place/to/put/uploaded/file);

and here a strange thing happened. The file was successfully 
copied BUT it had permissions like -rw-- which I interpret as 
only accessible to root. I tried copy() function instead and it 
failed.


I think I have tried every thing I could think of .. so please 
HELP :)

jaski

NP. I am subscribed to the digest version so kindly cc any replies 
to me as well. Thanks.

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




Re: [PHP] file uploads problem

2002-09-23 Thread Oscar F

Try:

$upload = /path/to/copy/;
$upload_path = $upload/$file_filename;
if (is_uploaded_file($file)) {
 Exec(cp $filename $upload_path);
}

Then you have the file at /path/to/copy/filename, and you can do 
whatever you want with it. (I'm assuming the file field of the form is 
called file, and that /path/to/copy/ has permissions set so that PHP 
can write to it, 777 will work for sure, but I'm not 100% positive which 
one would be best due to security and stuff.).

HTH. Oscar.-

Jaski wrote:

 Hi,
 (Linux RH 7.1, Apache/1.3.22, PHP 4.0.6).

 I am trying to write a script to send emails. It needs to support 
 attachments. The point where I am stuck is after the file to be 
 attached gets uploaded to /tmp as /tmp/tempfilename thorough an HTTP 
 POST form.

 I am not able to open that file directly .. follwing error shows up.

 Warning: fopen(/tmp/phpOaILXx,rb) - Operation not
 permitted in
 /var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php
 on line 254


 I tried to copy this file using
 move_uploaded_file($userfile, /place/to/put/uploaded/file);

 and here a strange thing happened. The file was successfully copied 
 BUT it had permissions like -rw-- which I interpret as only 
 accessible to root. I tried copy() function instead and it failed.


 I think I have tried every thing I could think of .. so please HELP :)

 jaski

 NP. I am subscribed to the digest version so kindly cc any replies to 
 me as well. Thanks.




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




Re: Re: [PHP] file uploads problem

2002-09-23 Thread Jaski

Thanks .. but I think you are saying exactly what I wrote  I was 
doing .. except that you have used exec(cp $file $path) while I 
tried PHP's copy() function .. I don't think that will make a 
difference...though will give that a try any way.

Forgot to mention in my previous mail that the directory where I 
am trying to copy the uploaded file from /tmp is in 777 mode 
already.


Jaski

On Tue, 24 Sep 2002 Oscar F wrote :
Try:

$upload = /path/to/copy/;
$upload_path = $upload/$file_filename;
if (is_uploaded_file($file)) {
Exec(cp $filename $upload_path);
}

Then you have the file at /path/to/copy/filename, and you can 
do whatever you want with it. (I'm assuming the file field of the 
form is called file, and that /path/to/copy/ has permissions 
set so that PHP can write to it, 777 will work for sure, but I'm 
not 100% positive which one would be best due to security and 
stuff.).

HTH. Oscar.-

Jaski wrote:

Hi,
(Linux RH 7.1, Apache/1.3.22, PHP 4.0.6).

I am trying to write a script to send emails. It needs to 
support attachments. The point where I am stuck is after the 
file to be attached gets uploaded to /tmp as /tmp/tempfilename 
thorough an HTTP POST form.

I am not able to open that file directly .. follwing error shows 
up.

Warning: fopen(/tmp/phpOaILXx,rb) - Operation not
permitted in
/var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php
on line 254


I tried to copy this file using
move_uploaded_file($userfile, /place/to/put/uploaded/file);

and here a strange thing happened. The file was successfully 
copied BUT it had permissions like -rw-- which I interpret 
as only accessible to root. I tried copy() function instead and 
it failed.


I think I have tried every thing I could think of .. so please 
HELP :)

jaski

NP. I am subscribed to the digest version so kindly cc any 
replies to me as well. Thanks.





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




[PHP] file uploads problem?

2001-02-22 Thread Ed Lazor

File uploads -was- working.  I reinstalled the server with the RedHat packages

apache-1.3.14-3.rpm
php-4.0.4pl1-3.rpm
php-mysql-4.0.4pl1-3

I'm using the same scripts, but file uploads is not working 
now.  Correction... the file uploads to the server, but doesn't view 
properly when I try to load it in a browser.  If I grab it by ftp from the 
server and view it in Photoshop, it looks fine.

Any ideas?

-Ed


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] file uploads problem?

2001-02-22 Thread Ed Lazor

More info:

I transferred an image to the web server via ftp and was able to view it 
successfully from the web site.

Here's an example image that was transferred using a file upload form that 
won't display properly:

http://www.atfantasy.com/attachments/3224/samurai1.jpg

When you try to view it, it just displays a box with a small x, as if the 
image wasn't there.  I've verified the image is there.

What would be doing this?

-Ed


At 05:30 PM 2/22/2001 -0800, Ed Lazor wrote:
File uploads -was- working.  I reinstalled the server with the RedHat packages

 apache-1.3.14-3.rpm
 php-4.0.4pl1-3.rpm
 php-mysql-4.0.4pl1-3

I'm using the same scripts, but file uploads is not working 
now.  Correction... the file uploads to the server, but doesn't view 
properly when I try to load it in a browser.  If I grab it by ftp from the 
server and view it in Photoshop, it looks fine.

Any ideas?

-Ed


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] more info: Re: [PHP] file uploads problem?

2001-02-22 Thread Ed Lazor

I was curious, so I uploaded a file using the upload form and transferred 
the same file via ftp and did a diff on the two files.  Here's the results:

diff -a Poster.jpg Poster_test.jpg
0a1,2
  Content-Type: image/pjpeg
 

Does that help?

-Ed

At 06:01 PM 2/22/2001 -0800, Ed Lazor wrote:
More info:

I transferred an image to the web server via ftp and was able to view it 
successfully from the web site.

Here's an example image that was transferred using a file upload form that 
won't display properly:

http://www.atfantasy.com/attachments/3224/samurai1.jpg

When you try to view it, it just displays a box with a small x, as if the 
image wasn't there.  I've verified the image is there.

What would be doing this?

-Ed


At 05:30 PM 2/22/2001 -0800, Ed Lazor wrote:
File uploads -was- working.  I reinstalled the server with the RedHat 
packages

 apache-1.3.14-3.rpm
 php-4.0.4pl1-3.rpm
 php-mysql-4.0.4pl1-3

I'm using the same scripts, but file uploads is not working 
now.  Correction... the file uploads to the server, but doesn't view 
properly when I try to load it in a browser.  If I grab it by ftp from 
the server and view it in Photoshop, it looks fine.

Any ideas?

-Ed


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]