Re: [PHP] Upload is still not working

2004-11-23 Thread Burhan Khalid
Michael Leung wrote:
Hi Jason,
 Thank you for your help. This is the output from PHP script:
upload_files is valid a directoryI am able to write to upload_files
Warning: move_uploaded_file(upload_files/Water lilies.jpg)
[function.move-uploaded-file]: failed to open stream: Permission
denied in /var/www/html/simple_upload.php on line 58
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
move '/tmp/phpHuSGRK' to 'upload_files/Water lilies.jpg' in
/var/www/html/simple_upload.php on line 58
Well, this shows upload_files is writeable. Therefore, it should not
be any error in permission setting issues.
Could it be the space in the filename?
--
Burhan Khalid
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Upload is still not working

2004-11-23 Thread Michael Leung
Hi,
   I have tested this with file no space on its filename


yours,
Michael

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



Re: [PHP] Upload is still not working ( More tesitngs)

2004-11-22 Thread Michael Leung
Hi Everyone,
  I found some people stated this kind of error , because phpSUExec
max allows 755.  But  I have changed my upload_files  directory into
owned by apache. it should solved the problem based on this logic. but
it won't work at all.

Does Any one have an idea on this

yours,
Michael Leung



 Michael Leung wrote:
 
 My Error Msg:
   I can read /tmp/phphRiKeP
 Warning: fopen(upload_files/doodah) [function.fopen]: failed to open
 stream: Permission denied in /var/www/html/simple_upload.php on line
 18
 
 Warning: fopen(upload_files/Water lilies.jpg) [function.fopen]: failed
 to open stream: Permission denied in /var/www/html/simple_upload.php
 on line 22
 upload_files is valid a directoryI am able to write to upload_files
 
 
 This is very strange. upload_files is writeable, but can't write by
 fopen('upload_files/doodah', 'w')
 
 

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



[PHP] Upload is still not working

2004-11-21 Thread Michael Leung
Hi all,
  I have already checked all parent dir are in 777 too.
But this is not working

Anyone can help me?

yours,
Michael

On Monday 22 November 2004 10:56, Michael Leung wrote:

I am implementing a upload file PHP program. The script is not
 working. it keeps on generating the permission Error.
 I am not very sure this is PHP or Apache problem. But one things I can
 sure I changed all upload file dir in 777.

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



[PHP] Upload is still not working

2004-11-21 Thread Michael Leung
Hi all,
  I have some problems for upload file script. The script generated a
lot of permission denied error msg. I have changed the upload dir and
its parent dir into 777. I am quite sure I did the permission settings
right.

I have attached the error msg and my testing source code with this email

Anyone can help me .

Thanks!

yours,
Michael

My Error Msg: 

Warning: move_uploaded_file(upload_files/Blue hills.jpg)
[function.move-uploaded-file]: failed to open stream: Permission
denied in /var/www/html/simple_upload.php on line 47

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
move '/tmp/phpvdnBbQ' to 'upload_files/Blue hills.jpg' in
/var/www/html/simple_upload.php on line 47
Somthing is wrong with uploading a file.

My Testing Code:
?php

$site_name = $_SERVER['HTTP_HOST'];
$url_dir = http://.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$url_this =  http://.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

$upload_dir = 'upload_files/';
$upload_url = $url_dir.upload/;
$message =;


if ($_FILES['userfile']) {
$message = do_upload($upload_dir, $upload_url);
}
else {
$message = Invalid File Specified.;
}

print $message;

function do_upload($upload_dir, $upload_url) {

$temp_name = $_FILES['userfile']['tmp_name'];
$file_name = $_FILES['userfile']['name']; 
$file_type = $_FILES['userfile']['type']; 
$file_size = $_FILES['userfile']['size']; 
$result= $_FILES['userfile']['error'];
$file_url  = $upload_url.$file_name;
$file_path = $upload_dir.$file_name;

//File Name Check
if ( $file_name ==) { 
$message = Invalid File Name Specified;
return $message;
}
//File Size Check
else if ( $file_size  50) {
$message = The file size is over 500K.;
return $message;
}
//File Type Check
else if ( $file_type == text/plain ) {
$message = Sorry, You cannot upload any script file ;
return $message;
}

$result  =  move_uploaded_file($temp_name, $file_path);


$message = ($result)?File url a href=$file_url$file_url/a :
  Somthing is wrong with uploading a file.;

return $message;
}
?
form name=upload id=upload ENCTYPE=multipart/form-data method=post
  Upload Imageinput type=file id=userfile name=userfile
  input type=submit name=upload value=Upload
/form

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



Re: [PHP] Upload is still not working

2004-11-21 Thread Jason Wong
On Monday 22 November 2004 11:25, Michael Leung wrote:

Please do not top post.

   I have already checked all parent dir are in 777 too.
 But this is not working

Post some *concise* code that illustrates your problem.

Post the full error message(s) that you get.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Consultant, n.:
 An ordinary man a long way from home.
*/

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



Re: [PHP] Upload is still not working

2004-11-21 Thread Jason Wong
On Monday 22 November 2004 12:14, Michael Leung wrote:

   I have some problems for upload file script. The script generated a
 lot of permission denied error msg. I have changed the upload dir and
 its parent dir into 777. I am quite sure I did the permission settings
 right.

 I have attached the error msg and my testing source code with this email

 Warning: move_uploaded_file(upload_files/Blue hills.jpg)
 [function.move-uploaded-file]: failed to open stream: Permission
 denied in /var/www/html/simple_upload.php on line 47

Add the following lines to the top of your code and us show the output of:

  if (is_dir('upload_files')) {
echo ('upload_files is valid a directory');
  } else {
echo ('upload_files is NOT a directory');
  }
  if (is_writeable('upload_files')) {
echo ('I am able to write to upload_files');
  } else {
echo ('I am NOT able to write to upload_files');
  }

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Marriage is not merely sharing the fettucine, but sharing the
burden of finding the fettucine restaurant in the first place.
  -- Calvin Trillin
*/

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



Re: [PHP] Upload is still not working

2004-11-21 Thread Michael Leung
Hi Jason,
 Thank you for your help. This is the output from PHP script:
upload_files is valid a directoryI am able to write to upload_files
Warning: move_uploaded_file(upload_files/Water lilies.jpg)
[function.move-uploaded-file]: failed to open stream: Permission
denied in /var/www/html/simple_upload.php on line 58

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
move '/tmp/phpHuSGRK' to 'upload_files/Water lilies.jpg' in
/var/www/html/simple_upload.php on line 58

Well, this shows upload_files is writeable. Therefore, it should not
be any error in permission setting issues.

yours,
Michael

On Mon, 22 Nov 2004 13:54:28 +0800, Jason Wong [EMAIL PROTECTED] wrote:
 On Monday 22 November 2004 12:14, Michael Leung wrote:



I have some problems for upload file script. The script generated a
  lot of permission denied error msg. I have changed the upload dir and
  its parent dir into 777. I am quite sure I did the permission settings
  right.
 
  I have attached the error msg and my testing source code with this email

  Warning: move_uploaded_file(upload_files/Blue hills.jpg)
  [function.move-uploaded-file]: failed to open stream: Permission
  denied in /var/www/html/simple_upload.php on line 47

 Add the following lines to the top of your code and us show the output of:

   if (is_dir('upload_files')) {
 echo ('upload_files is valid a directory');
   } else {
 echo ('upload_files is NOT a directory');
   }
   if (is_writeable('upload_files')) {
 echo ('I am able to write to upload_files');
   } else {
 echo ('I am NOT able to write to upload_files');
   }

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Marriage is not merely sharing the fettucine, but sharing the
 burden of finding the fettucine restaurant in the first place.
   -- Calvin Trillin
 */

 --
 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: [PHP] Upload is still not working

2004-11-21 Thread Jason Wong
On Monday 22 November 2004 14:01, Michael Leung wrote:

Please do not top post.

  Thank you for your help. This is the output from PHP script:
 upload_files is valid a directoryI am able to write to upload_files
 Warning: move_uploaded_file(upload_files/Water lilies.jpg)
 [function.move-uploaded-file]: failed to open stream: Permission
 denied in /var/www/html/simple_upload.php on line 58

 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
 move '/tmp/phpHuSGRK' to 'upload_files/Water lilies.jpg' in
 /var/www/html/simple_upload.php on line 58

 Well, this shows upload_files is writeable. Therefore, it should not
 be any error in permission setting issues.

Add these following tests to the top of your code:

error_reporting(E_ALL);
ini_set('display_errors', TRUE);   

if (is_readable($_FILES['userfile']['tmp_name'])) {
echo I can read  . $_FILES['userfile']['tmp_name'];
}

if ($fp0 = fopen('upload/doodah', 'w')) {
echo 'I can open upload/doodah for writing';
}

if ($fp1 = fopen('upload/' . $_FILES['userfile']['name'], 'w')) {
echo 'I can open upload/' . $_FILES['userfile']['name'] . ' for 
writing';
}

Also what is your safe_mode setting? Usually when something fails because of 
safe_mode setting the error would explicitly say it failed because of 
safe_mode setting.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If you wish to succeed, consult three old people.
*/

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



[PHP] Upload is still not working ( More tesitngs)

2004-11-21 Thread Michael Leung
Hi All,
 I did more testes

I have added the followings code into my script
error_reporting(E_ALL);
   ini_set('display_errors', TRUE);

   if (is_readable($_FILES['userfile']['tmp_name'])) {
   echo I can read  . $_FILES['userfile']['tmp_name'];
   }

   if ($fp0 = fopen('upload_files/doodah', 'w')) {
   echo 'I can open upload/doodah for writing';
   }

   if ($fp1 = fopen('upload_files/' . $_FILES['userfile']['name'], 'w')) {
   echo 'I can open upload_files/' . $_FILES['userfile']['name'] . ' for
writing';
   }

 if (is_dir('upload_files')) {
   echo ('upload_files is valid a directory');
 } else {
   echo ('upload_files is NOT a directory');
 }
 if (is_writeable('upload_files')) {
   echo ('I am able to write to upload_files');
 } else {
   echo ('I am NOT able to write to upload_files');
 }



My Error Msg:
  I can read /tmp/phphRiKeP
Warning: fopen(upload_files/doodah) [function.fopen]: failed to open
stream: Permission denied in /var/www/html/simple_upload.php on line
18

Warning: fopen(upload_files/Water lilies.jpg) [function.fopen]: failed
to open stream: Permission denied in /var/www/html/simple_upload.php
on line 22
upload_files is valid a directoryI am able to write to upload_files


This is very strange. upload_files is writeable, but can't write by
fopen('upload_files/doodah', 'w')

yours,
Michael Leung

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



Re: [PHP] Upload is still not working ( More tesitngs)

2004-11-21 Thread Raditha Dissanayake
Michael Leung wrote:
My Error Msg:
 I can read /tmp/phphRiKeP
Warning: fopen(upload_files/doodah) [function.fopen]: failed to open
stream: Permission denied in /var/www/html/simple_upload.php on line
18
Warning: fopen(upload_files/Water lilies.jpg) [function.fopen]: failed
to open stream: Permission denied in /var/www/html/simple_upload.php
on line 22
upload_files is valid a directoryI am able to write to upload_files
This is very strange. upload_files is writeable, but can't write by
fopen('upload_files/doodah', 'w')
 

Nothing strange about that it may be writable by the owner but not by 
others. Besides that as jason as already pointed out you may be running 
in safe mode. Other than that, the file upload page on php.net has a 
wealth of information posted by others like you who had trouble with 
their uploads, you are sure to find a usefull comment there.

--
Raditha Dissanayake
http://www.radinks.com/upload/ - Drag and Drop File Upload
yours,
Michael Leung
 

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