Re: [PHP] upload problem

2008-01-22 Thread Chris

nihilism machine wrote:

any ideas why this does not work?


1) the field in the form might not be 'upload1'.
2) the file is too big to upload (> max_upload_size)
3) the /tmp folder might not be writable or full
4) the folder you're trying to write into is not writable (or the drive 
is full)

5) the rename might not work (same reasons as above)
6) the chmod might fail

that'll do for starters :)

add

error_reporting(E_ALL);
and
ini_set('display_errors', true);

in your script and see what's going on.


instead of doing a move-uploaded-file then a rename, combine them:

$destination = 'admin/advertisements/' . 
basename($_FILES['upload1']['name']);


if (move_uploaded_file($src, $destination)) {
...
}
...

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] upload problem

2008-01-22 Thread Daniel Brown
On Jan 22, 2008 8:01 PM, nihilism machine <[EMAIL PROTECTED]> wrote:
> any ideas why this does not work?
>
>
> class upload {
>
> function upload() {
> upload::uploader();
> }
>
> function uploader() {
> $FileName = basename($_FILES['upload1']['name']);
> if (move_uploaded_file($_FILES['upload1']['tmp_name'], 
> $FileName)) {
> chmod($FileName, 0755);
> rename($FileName, "admin/advertisements/" . 
> $FileName);
> return $FileName;
> } else {
> return "Error!";
> }
> }
> }

What do you mean "doesn't work"?  Does it hit the "Error!" return,
does it do nothing, does it come up with a build error?  If you're
more specific, you'll get better responses and quicker help.

-- 


Daniel P. Brown
Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since
Nineteen-Seventy-[mumble].

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



Re: [PHP] upload problem

2008-01-22 Thread Casey
On Jan 22, 2008, at 5:01 PM, nihilism machine  
<[EMAIL PROTECTED]> wrote:



any ideas why this does not work?


class upload {

   function upload() {
   upload::uploader();
   }

   function uploader() {
   $FileName = basename($_FILES['upload1']['name']);
   if (move_uploaded_file($_FILES['upload1']['tmp_name'],  
$FileName)) {

   chmod($FileName, 0755);
   rename($FileName, "admin/advertisements/" . $FileName);
   return $FileName;
   } else {
   return "Error!";
   }
   }
}


Try deleting the upload() function. Then:

$test = new upload();
$filename = test->uploader();

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



[PHP] upload problem

2008-01-22 Thread nihilism machine

any ideas why this does not work?


class upload {

function upload() {
upload::uploader();
}

function uploader() {
$FileName = basename($_FILES['upload1']['name']);
if (move_uploaded_file($_FILES['upload1']['tmp_name'], 
$FileName)) {
chmod($FileName, 0755);
rename($FileName, "admin/advertisements/" . $FileName);
return $FileName;
} else {
return "Error!";
}
}
}

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



Re: [PHP] Upload problem - final size is different

2007-05-08 Thread Eric Trahan

Le 2007-05-08 à 16:50, Richard Davey a écrit :

By how much is the difference? Are we talking a few bytes, a few  
megabytes, what?


A 116Kb file produce a 68Kb file on the server.  And a 152Kb file  
produce a 48Kb file on the server...




If you then download the file again, is it corrupted, or does it work?


Download the same file twice produce the same problem...


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



Re: [PHP] Upload problem - final size is different

2007-05-08 Thread Richard Lynch
On Tue, May 8, 2007 2:12 pm, Eric Trahan wrote:
> $error = $_FILES['uneimage']['error'];
>
> That doesn't seem work in PHP 4.1.2...  I try it but $error is empty.
>
>
> And the function move_uploaded_file($_FILES['uneimage']['tmp_name'],
> $target_path) returns TRUE, so the upload work (in a way !).
>
> The problem is the file that is upload doesn't match the original
> file.

Is it truncated?

Does have random bytes in the middle missing?

Does only the last half of the file come through?

Is it a Mac with a resource fork not getting through?

How are you measuring the two file sizes?

PS You *still* should have the error checking, if it's available in
your version of PHP.

Actually, at 4.1.2 you probably should upgrade, I suspect,
irrespective of anything else anybody can say...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Upload problem - final size is different

2007-05-08 Thread Richard Davey

Eric Trahan wrote:


$error = $_FILES['uneimage']['error'];

That doesn't seem work in PHP 4.1.2...  I try it but $error is empty.


It just means there wasn't an error.

And the function move_uploaded_file($_FILES['uneimage']['tmp_name'], 
$target_path) returns TRUE, so the upload work (in a way !).


The problem is the file that is upload doesn't match the original file.


By how much is the difference? Are we talking a few bytes, a few 
megabytes, what?


If you then download the file again, is it corrupted, or does it work?

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

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



Re: [PHP] Upload problem - final size is different

2007-05-08 Thread Eric Trahan

$error = $_FILES['uneimage']['error'];

That doesn't seem work in PHP 4.1.2...  I try it but $error is empty.


And the function move_uploaded_file($_FILES['uneimage']['tmp_name'],  
$target_path) returns TRUE, so the upload work (in a way !).


The problem is the file that is upload doesn't match the original file.

Eric.


Le 2007-05-08 à 14:04, Richard Lynch a écrit :


On Tue, May 8, 2007 11:30 am, Eric Trahan wrote:


The upload work.  The user file is uploaded to my destination folder
(page5/) but the file is unreadable and the file size is smaller than
the original file size.



$tmp_name = $_FILES['uneimage']['tmp_name'];
$type = $_FILES['uneimage']['type'];
$name = $_FILES['uneimage']['name'];
$size = $_FILES['uneimage']['size'];


$error = $_FILES['uneimage']['error'];
switch($error){
  //There are at least 5 or 6 'case' statements that go here
  //read the manual to find them
}

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?



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



Re: [PHP] Upload problem - final size is different

2007-05-08 Thread Richard Lynch
On Tue, May 8, 2007 11:30 am, Eric Trahan wrote:

> The upload work.  The user file is uploaded to my destination folder
> (page5/) but the file is unreadable and the file size is smaller than
> the original file size.

> $tmp_name = $_FILES['uneimage']['tmp_name'];
> $type = $_FILES['uneimage']['type'];
> $name = $_FILES['uneimage']['name'];
> $size = $_FILES['uneimage']['size'];

$error = $_FILES['uneimage']['error'];
switch($error){
  //There are at least 5 or 6 'case' statements that go here
  //read the manual to find them
}

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Upload problem - final size is different

2007-05-08 Thread Eric Trahan

Hi,

I have a form to upload file on my web server, so user can upload  
their images.


The upload work.  The user file is uploaded to my destination folder  
(page5/) but the file is unreadable and the file size is smaller than  
the original file size.


I run Apache with PHP 4.1.2.

Thank you,

Eric.


Here is the form code:

method="post">


Une image
Du texte: 




Here is my PHP upload code:

";

$tmp_name = $_FILES['uneimage']['tmp_name'];
$type = $_FILES['uneimage']['type'];
$name = $_FILES['uneimage']['name'];
$size = $_FILES['uneimage']['size'];

echo $tmp_name . "" . $type . "" . $name . "";

$target_path = "page5/";

$target_path = $target_path . basename( $_FILES['uneimage']['name']);

echo $target_path;

if(move_uploaded_file($_FILES['uneimage']['tmp_name'], $target_path)) {
echo "The file ".  basename( $_FILES['uneimage']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>

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



Re: [PHP] Upload problem

2003-07-28 Thread Jason Wong
On Monday 28 July 2003 21:47, Rosen wrote:

> I have some problem with uploading files on server with PHP.
> The upload is ok, but I must set directory permissions with FULL Access -
> but this is not a good idea :((
> Have someone idea how I can do this with no setting permissions to full
> acess ?

What do you mean by FULL Access? The upload directory(ies) (both temporary and 
final destination) only needs to be +wx for the webserver user. It does not 
have to be world accessible.

-- 
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
--
/*
Your car never malfunctions or makes the same noise in front of your mechanic
-- Murphy's Driving Laws n16
*/


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



[PHP] Upload problem

2003-07-28 Thread Rosen


Hi,
I have some problem with uploading files on server with PHP.
The upload is ok, but I must set directory permissions with FULL Access -
but this is not a good idea :((
Have someone idea how I can do this with no setting permissions to full
acess ?

Thanks,
Rosen
reserved!



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



Re: [PHP] upload problem, urgent plz guy

2003-05-29 Thread Marek Kilimajer
Use move_uploaded_file() instead of copy()

fr r wrote:

i'm trying to do a very simple thing:
upload image but it keep giving me this error although i gave permession on folder:
Warning: open_basedir restriction in effect. File is in wrong directory in /var/www/vhosts/negoumelshasha.com/httpdocs/test4.php on line 9
and here is my code:
//
 
   
   if (isset($submit))
 { 
   if ($upload != 'none')
  { 
   $dest = $uploadDir . $upload_name; 
   if (copy($upload, $dest))
   { 
   echo "Successfully uploaded $dest\n"; 
   } 
   else
   { 
   echo "File Upload Failed\n"; 
   $perms = @fileperms($uploadDir); 
   $owner = @fileowner($uploadDir); 
   if (!$perms)
{ 
   echo "Directory does not exist: $uploadDir\n"; 
   } 
   else
{ 
   $myuid = getmyuid(); 
   if (!($perms & 2) && !(($owner == $myuid) && ($perms & 128)))
 { 
   echo get_current_user(), " doesn't have permission to write in $uploadDir\n"; 
   } 
   } 
   } 
   } 
   else
  { 
   echo "File2 Upload Failed\n"; 
   echo "Filesize exceeds limit in FORM or php.ini\n"; 
   } 
   } 
   ?> 


   Upload File:  


 

-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).
 



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


RE: [PHP] upload problem, urgent plz guy

2003-05-29 Thread Jay Blanchard
[snip]
i'm trying to do a very simple thing:
upload image but it keep giving me this error although i gave permession
on folder:
 
Warning: open_basedir restriction in effect. File is in wrong directory
in /var/www/vhosts/negoumelshasha.com/httpdocs/test4.php on line 9
[/snip]

Have you read and tried
http://us4.php.net/manual/en/features.file-upload.php ? 

HTH!

Jay

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



[PHP] upload problem, urgent plz guy

2003-05-29 Thread fr r
i'm trying to do a very simple thing:
upload image but it keep giving me this error although i gave permession on folder:
 
Warning: open_basedir restriction in effect. File is in wrong directory in 
/var/www/vhosts/negoumelshasha.com/httpdocs/test4.php on line 9
 
and here is my code:
//
 
\n"; 
} 
else
{ 
echo "File Upload Failed\n"; 
$perms = @fileperms($uploadDir); 
$owner = @fileowner($uploadDir); 
if (!$perms)
 { 
echo "Directory does not exist: $uploadDir\n"; 
} 
else
 { 
$myuid = getmyuid(); 
if (!($perms & 2) && !(($owner == $myuid) && ($perms & 128)))
  { 
echo get_current_user(), " doesn't have permission to 
write in $uploadDir\n"; 
} 
} 
} 
} 
else
   { 
echo "File2 Upload Failed\n"; 
echo "Filesize exceeds limit in FORM or php.ini\n"; 
} 
} 
?> 
 
 
Upload File:  
 
 
 



-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

[PHP] upload problem, urgent plz guy

2003-05-29 Thread fr r
i'm trying to do a very simple thing:
upload image but it keep giving me this error although i gave permession on folder:
 
Warning: open_basedir restriction in effect. File is in wrong directory in 
/var/www/vhosts/negoumelshasha.com/httpdocs/test4.php on line 9
 
and here is my code:
//
 
\n"; 
} 
else
{ 
echo "File Upload Failed\n"; 
$perms = @fileperms($uploadDir); 
$owner = @fileowner($uploadDir); 
if (!$perms)
 { 
echo "Directory does not exist: $uploadDir\n"; 
} 
else
 { 
$myuid = getmyuid(); 
if (!($perms & 2) && !(($owner == $myuid) && ($perms & 128)))
  { 
echo get_current_user(), " doesn't have permission to 
write in $uploadDir\n"; 
} 
} 
} 
} 
else
   { 
echo "File2 Upload Failed\n"; 
echo "Filesize exceeds limit in FORM or php.ini\n"; 
} 
} 
?> 
 
 
Upload File:  
 
 
 


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

[PHP] upload problem, urgent plz guy

2003-05-29 Thread fr r
i'm trying to do a very simple thing:
upload image but it keep giving me this error although i gave permession on folder:
Warning: open_basedir restriction in effect. File is in wrong directory in 
/var/www/vhosts/negoumelshasha.com/httpdocs/test4.php on line 9
and here is my code:
//
 
\n"; 
} 
else
{ 
echo "File Upload Failed\n"; 
$perms = @fileperms($uploadDir); 
$owner = @fileowner($uploadDir); 
if (!$perms)
 { 
echo "Directory does not exist: $uploadDir\n"; 
} 
else
 { 
$myuid = getmyuid(); 
if (!($perms & 2) && !(($owner == $myuid) && ($perms & 128)))
  { 
echo get_current_user(), " doesn't have permission to 
write in $uploadDir\n"; 
} 
} 
} 
} 
else
   { 
echo "File2 Upload Failed\n"; 
echo "Filesize exceeds limit in FORM or php.ini\n"; 
} 
} 
?> 
 
 
Upload File:  
 
 
 


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

Re: [PHP] Upload problem - PC, *nix, and Max EOL characters

2002-11-26 Thread Lee P. Reilly
Ah, okay. However, it seems to ignore a Mac EOL character. I'm installing the
PHP4.3 (test version) to try the auto_detect_line_endings configuration option.

Cheers,
Lee

Matt Vos wrote:

> No, fgets() reads to EOL, I use it all the time.
> fread() will read to EOF, if you let it, as it is binary safe.
>
> Matt
> - Original Message -
> From: Lee P. Reilly <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 26, 2002 4:09 PM
> Subject: Re: [PHP] Upload problem - PC, *nix, and Max EOL characters
>
> >
> > Hi,
> >
> > Thanks for the reply. I appreciate your help. fgets() reads to the EOF;
> not the
> > EOL. Is there something similar to fgets() that I can use? Perhaps where I
> can
> > state explicity read the file until you encounter and EOL char?
> >
> > Cheers,
> > Lee
> >
> > Matt Vos wrote:
> >
> > > Loop an fgets()
> > >
> > > i.e.
> > > $fp = fopen($file)
> > > while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL,
> whichever
> > > is first) */
> > > {
> >
> > --
> > Lee P. Reilly,  ms:G758
> > Szilard Resource,  tel:505-665-7025
> > Bioscience Division,
> > SM-30 Bikini Atoll Rd,
> > Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
> > Los Alamos, NM 87545.  http://home.lanl.gov/lreilly
> >
> >   "Quidquid latine dictum sit, altum viditur"
> >
> > -.__.--'"`'--.__.--'"`'--.__.--'"`'--.__
> > '-:`.'|`|"':-.  '-:`.'|`|"':-.  '-:`.'|`|"':-.  '.` : '.
> >   '.  '.  | |  | |'.  '.  | |  | |'.  '.  | |  | |'.  '.:   '.  '.
> >   : '.  '.| |  | |  '.  '.| |  | |  '.  '.| |  | |  '.  '.  : '.  `.
> >   '   '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.'   `.
> >  `-..,..-'   `-..,..-'   `-..,..-'   ` `
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

--
Lee P. Reilly,  ms:G758
Szilard Resource,  tel:505-665-7025
Bioscience Division,
SM-30 Bikini Atoll Rd,
Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
Los Alamos, NM 87545.  http://home.lanl.gov/lreilly

  "Quidquid latine dictum sit, altum viditur"

-.__.--'"`'--.__.--'"`'--.__.--'"`'--.__
'-:`.'|`|"':-.  '-:`.'|`|"':-.  '-:`.'|`|"':-.  '.` : '.
  '.  '.  | |  | |'.  '.  | |  | |'.  '.  | |  | |'.  '.:   '.  '.
  : '.  '.| |  | |  '.  '.| |  | |  '.  '.| |  | |  '.  '.  : '.  `.
  '   '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.'   `.
 `-..,..-'   `-..,..-'   `-..,..-'   ` `



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




Re: [PHP] Upload problem - PC, *nix, and Max EOL characters

2002-11-26 Thread Matt Vos
No, fgets() reads to EOL, I use it all the time.
fread() will read to EOF, if you let it, as it is binary safe.

Matt
- Original Message -
From: Lee P. Reilly <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 26, 2002 4:09 PM
Subject: Re: [PHP] Upload problem - PC, *nix, and Max EOL characters


>
> Hi,
>
> Thanks for the reply. I appreciate your help. fgets() reads to the EOF;
not the
> EOL. Is there something similar to fgets() that I can use? Perhaps where I
can
> state explicity read the file until you encounter and EOL char?
>
> Cheers,
> Lee
>
> Matt Vos wrote:
>
> > Loop an fgets()
> >
> > i.e.
> > $fp = fopen($file)
> > while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL,
whichever
> > is first) */
> > {
>
> --
> Lee P. Reilly,  ms:G758
> Szilard Resource,  tel:505-665-7025
> Bioscience Division,
> SM-30 Bikini Atoll Rd,
> Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
> Los Alamos, NM 87545.  http://home.lanl.gov/lreilly
>
>   "Quidquid latine dictum sit, altum viditur"
>
> -.__.--'"`'--.__.--'"`'--.__.--'"`'--.__
> '-:`.'|`|"':-.  '-:`.'|`|"':-.  '-:`.'|`|"':-.  '.` : '.
>   '.  '.  | |  | |'.  '.  | |  | |'.  '.  | |  | |'.  '.:   '.  '.
>   : '.  '.| |  | |  '.  '.| |  | |  '.  '.| |  | |  '.  '.  : '.  `.
>   '   '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.'   `.
>  `-..,..-'   `-..,..-'   `-..,..-'   ` `
>
>
>
> --
> 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 problem - PC, *nix, and Max EOL characters

2002-11-26 Thread Lee P. Reilly
Actually, there appears to be a solution on the PHP.web
[http://www.php.net/manual/en/function.fgets.php]

"Note: The length parameter became optional in PHP 4.2.0, if omitted, it would
assume 1024 as the line length. As of PHP 4.3, omitting length will keep reading
from the stream until it reaches the end of the line. If the majority of the
lines in the file are all larger than 8KB, it is more resource efficient for
your script to specify the maximum line length. "

Thanks :-)

Matt Vos wrote:

> Loop an fgets()
>
> i.e.
> $fp = fopen($file)
> while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL, whichever
> is first) */
> {
>  $filerow = str_replace("; ","", $filerow);
>  $filerow = str_replace("# ","", $filerow);
>  $filerow = str_replace("\r","", $filerow);
>  $size = strlen($filerow);
>  $row_split = preg_split("/\s+/", $filerow);
>
>  $value1 = $row_split[0];
>  $value2 = $row_split[1];
>  $value3 = $row_split[2];
> }
>
> Matt
> - Original Message -
> From: Lee P. Reilly <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 26, 2002 2:58 PM
> Subject: [PHP] Upload problem - PC, *nix, and Max EOL characters
>
> > Hi everyone,
> >
> > I have an application, where users can upload data files formatted as
> > follows:
> >
> > 0.0106375   686.60165.391
> > 0.01147   606.46754.997
> > 0.0122815   640.284   46.5355
> > 0.0130753   668.396   39.3671
> > 0.0138809690.05   34.6031
> > 0.0146936   619.947   30.5329
> > 0.0155071   640.413   26.9145
> >
> >
> > My code deals with the uploaded files by splitting the lines into an
> > array, and then obtaining the 3 particular fields from the array
> > elements. My code is something like this:
> >
> > -=-= BEGIN CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > // put each line of the file into an array
> > $filearray = file($file);
> >
> > // parse the file one line... at... a... time
> > while (list(,$oneline) = each($filearray))
> > {
> >   // if the line starts with ";" or a "#"...
> >   if ($oneline[0]==";" || $oneline[0]=="#")
> >   {
> > // take out the ";" and EOL characters
> > $oneline = str_replace("; ","", $oneline);
> > $oneline = str_replace("# ","", $oneline);
> > $oneline = str_replace("\r","", $oneline);
> > $size = strlen($oneline);
> >   }
> >
> >   /* Some IQ files seperated columns by tabs; others, by whitespace.
> >  We parse the data file are delimit the columns by 'X9728430182298Z'
> >  (a random string), which will allow the program to recognise the
> > start
> >  and end of each column.
> >
> > e.g.
> > 0.00542   8691.64   901.605
> > 0.0067759381.3   1235.78 becomes...
> >
> > 0.00542X9728430182298Z8691.64X9728430182298Z901.605
> > 0.006775X9728430182298Z9381.3X9728430182298Z1235.78
> >   */
> >
> > $oneline = ltrim($oneline);
> > $oneline = preg_replace("/\s+/", "X9728430182298Z", $oneline);
> > $text = explode ("X9728430182298Z", $oneline); // now element [0] = Q,
> > [1] = I. [2] = Error
> >
> > -=-= END CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >
> > This works perfectly well when the data is uploaded from a PC, but it
> > fails when it's uploaded from Mac/Unix. When I vied the uploaded file
> > the EOL characters *appear* as "
> > ", which I believe is actually "\n". When I output the contents of
> > $filearray[0] (uploaded via a PC) I get one line, but when I ouput
> > $filearray[0] from a file uploaded via a Mac I get the entire file.
> > Therefore the problem occurs with:
> >
> > $filearray = file($file);
> > while (list(,$oneline) = each($filearray))
> >
> > I thought I had found a solution to the problem on the web* where I
> > found the following extract of php.ini file:
> >
> > --
> > ; If your scripts have to deal with files from Macintosh systems,
> > ; or you are running on a Mac and need to deal with files from
> > ; unix or win32 systems, setting this flag will cause PHP to
> > ; automatically detect the EOL character in

Re: [PHP] Upload problem - PC, *nix, and Max EOL characters

2002-11-26 Thread Lee P. Reilly

Hi,

Thanks for the reply. I appreciate your help. fgets() reads to the EOF; not the
EOL. Is there something similar to fgets() that I can use? Perhaps where I can
state explicity read the file until you encounter and EOL char?

Cheers,
Lee

Matt Vos wrote:

> Loop an fgets()
>
> i.e.
> $fp = fopen($file)
> while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL, whichever
> is first) */
> {

--
Lee P. Reilly,  ms:G758
Szilard Resource,  tel:505-665-7025
Bioscience Division,
SM-30 Bikini Atoll Rd,
Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
Los Alamos, NM 87545.  http://home.lanl.gov/lreilly

  "Quidquid latine dictum sit, altum viditur"

-.__.--'"`'--.__.--'"`'--.__.--'"`'--.__
'-:`.'|`|"':-.  '-:`.'|`|"':-.  '-:`.'|`|"':-.  '.` : '.
  '.  '.  | |  | |'.  '.  | |  | |'.  '.  | |  | |'.  '.:   '.  '.
  : '.  '.| |  | |  '.  '.| |  | |  '.  '.| |  | |  '.  '.  : '.  `.
  '   '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.'   `.
 `-..,..-'   `-..,..-'   `-..,..-'   ` `



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




Re: [PHP] Upload problem - PC, *nix, and Max EOL characters

2002-11-26 Thread Matt Vos
Loop an fgets()

i.e.
$fp = fopen($file)
while ($filerow = fgets($fp,1024)) /* Read 1024 bytes or to EOL, whichever
is first) */
{
 $filerow = str_replace("; ","", $filerow);
 $filerow = str_replace("# ","", $filerow);
 $filerow = str_replace("\r","", $filerow);
 $size = strlen($filerow);
 $row_split = preg_split("/\s+/", $filerow);

 $value1 = $row_split[0];
 $value2 = $row_split[1];
 $value3 = $row_split[2];
}

Matt
- Original Message -
From: Lee P. Reilly <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 26, 2002 2:58 PM
Subject: [PHP] Upload problem - PC, *nix, and Max EOL characters


> Hi everyone,
>
> I have an application, where users can upload data files formatted as
> follows:
>
> 0.0106375   686.60165.391
> 0.01147   606.46754.997
> 0.0122815   640.284   46.5355
> 0.0130753   668.396   39.3671
> 0.0138809690.05   34.6031
> 0.0146936   619.947   30.5329
> 0.0155071   640.413   26.9145
>
>
> My code deals with the uploaded files by splitting the lines into an
> array, and then obtaining the 3 particular fields from the array
> elements. My code is something like this:
>
> -=-= BEGIN CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> // put each line of the file into an array
> $filearray = file($file);
>
> // parse the file one line... at... a... time
> while (list(,$oneline) = each($filearray))
> {
>   // if the line starts with ";" or a "#"...
>   if ($oneline[0]==";" || $oneline[0]=="#")
>   {
> // take out the ";" and EOL characters
> $oneline = str_replace("; ","", $oneline);
> $oneline = str_replace("# ","", $oneline);
> $oneline = str_replace("\r","", $oneline);
> $size = strlen($oneline);
>   }
>
>   /* Some IQ files seperated columns by tabs; others, by whitespace.
>  We parse the data file are delimit the columns by 'X9728430182298Z'
>  (a random string), which will allow the program to recognise the
> start
>  and end of each column.
>
> e.g.
> 0.00542   8691.64   901.605
> 0.0067759381.3   1235.78 becomes...
>
> 0.00542X9728430182298Z8691.64X9728430182298Z901.605
> 0.006775X9728430182298Z9381.3X9728430182298Z1235.78
>   */
>
> $oneline = ltrim($oneline);
> $oneline = preg_replace("/\s+/", "X9728430182298Z", $oneline);
> $text = explode ("X9728430182298Z", $oneline); // now element [0] = Q,
> [1] = I. [2] = Error
>
> -=-= END CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> This works perfectly well when the data is uploaded from a PC, but it
> fails when it's uploaded from Mac/Unix. When I vied the uploaded file
> the EOL characters *appear* as "
> ", which I believe is actually "\n". When I output the contents of
> $filearray[0] (uploaded via a PC) I get one line, but when I ouput
> $filearray[0] from a file uploaded via a Mac I get the entire file.
> Therefore the problem occurs with:
>
> $filearray = file($file);
> while (list(,$oneline) = each($filearray))
>
> I thought I had found a solution to the problem on the web* where I
> found the following extract of php.ini file:
>
> --
> ; If your scripts have to deal with files from Macintosh systems,
> ; or you are running on a Mac and need to deal with files from
> ; unix or win32 systems, setting this flag will cause PHP to
> ; automatically detect the EOL character in those files so that
> ; fgets() and file() will work regardless of the source of the file.
> ; auto_detect_line_endings = Off
> --
>
> However, this never solved the problem.
>
> The file itself is stored in a database, so how can I get rid of the EOL
> characters before it is being inserted? Is there a function to change
> the Unix EOL chars to PC EOL chars?
>
> Thanks in advance.
>
> - Best regards,
>Lee Reilly
>
>
*[http://216.239.33.100/search?q=cache:GwerlDVFv8wC:linux.sarang.net/ftp/mir
ror/development/language/php_cvs/php4/php.ini-dist+MAC+EOL+character+PHP&hl=
en&ie=UTF-8]
>
> --
> Lee P. Reilly,  ms:G758
> Szilard Resource,  tel:505-665-7025
> Bioscience Division,
> SM-30 Bikini Atoll Rd,
> Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
> Los Alamos, NM 87545.  http://home.la

[PHP] Upload problem - PC, *nix, and Max EOL characters

2002-11-26 Thread Lee P. Reilly
Hi everyone,

I have an application, where users can upload data files formatted as
follows:

0.0106375   686.60165.391
0.01147 606.46754.997
0.0122815   640.284   46.5355
0.0130753   668.396   39.3671
0.0138809690.05   34.6031
0.0146936   619.947   30.5329
0.0155071   640.413   26.9145


My code deals with the uploaded files by splitting the lines into an
array, and then obtaining the 3 particular fields from the array
elements. My code is something like this:

-=-= BEGIN CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// put each line of the file into an array
$filearray = file($file);

// parse the file one line... at... a... time
while (list(,$oneline) = each($filearray)) 
{
  // if the line starts with ";" or a "#"...
  if ($oneline[0]==";" || $oneline[0]=="#")
  {
// take out the ";" and EOL characters
$oneline = str_replace("; ","", $oneline);
$oneline = str_replace("# ","", $oneline);
$oneline = str_replace("\r","", $oneline);
$size = strlen($oneline);   
  } 

  /* Some IQ files seperated columns by tabs; others, by whitespace. 
 We parse the data file are delimit the columns by 'X9728430182298Z' 
 (a random string), which will allow the program to recognise the
start 
 and end of each column.

e.g.
0.00542   8691.64   901.605
0.0067759381.3   1235.78 becomes...
 
0.00542X9728430182298Z8691.64X9728430182298Z901.605
0.006775X9728430182298Z9381.3X9728430182298Z1235.78
  */

$oneline = ltrim($oneline);
$oneline = preg_replace("/\s+/", "X9728430182298Z", $oneline);
$text = explode ("X9728430182298Z", $oneline); // now element [0] = Q,
[1] = I. [2] = Error

-=-= END CODE =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This works perfectly well when the data is uploaded from a PC, but it
fails when it's uploaded from Mac/Unix. When I vied the uploaded file
the EOL characters *appear* as "
", which I believe is actually "\n". When I output the contents of
$filearray[0] (uploaded via a PC) I get one line, but when I ouput
$filearray[0] from a file uploaded via a Mac I get the entire file.
Therefore the problem occurs with:

$filearray = file($file);
while (list(,$oneline) = each($filearray)) 

I thought I had found a solution to the problem on the web* where I
found the following extract of php.ini file:

--
; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; auto_detect_line_endings = Off
--

However, this never solved the problem.

The file itself is stored in a database, so how can I get rid of the EOL
characters before it is being inserted? Is there a function to change
the Unix EOL chars to PC EOL chars?

Thanks in advance.

- Best regards,
   Lee Reilly

*[http://216.239.33.100/search?q=cache:GwerlDVFv8wC:linux.sarang.net/ftp/mirror/development/language/php_cvs/php4/php.ini-dist+MAC+EOL+character+PHP&hl=en&ie=UTF-8]

--
Lee P. Reilly,  ms:G758
Szilard Resource,  tel:505-665-7025
Bioscience Division,
SM-30 Bikini Atoll Rd,
Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
Los Alamos, NM 87545.  http://home.lanl.gov/lreilly

  "Quidquid latine dictum sit, altum viditur"

-.__.--'"`'--.__.--'"`'--.__.--'"`'--.__
'-:`.'|`|"':-.  '-:`.'|`|"':-.  '-:`.'|`|"':-.  '.` : '.
  '.  '.  | |  | |'.  '.  | |  | |'.  '.  | |  | |'.  '.:   '.  '.
  : '.  '.| |  | |  '.  '.| |  | |  '.  '.| |  | |  '.  '.  : '.  `.
  '   '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.:_ | :_.' '.  `.'   `.
 `-..,..-'   `-..,..-'   `-..,..-'   ` `

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




Re: [PHP] Upload Problem

2002-10-13 Thread Sascha Cunz

Hi,
as far as i can follow you, you want to:
  1. copy a file from position a to position b.
  2. read it from position b.
  3. and delete it at position b.

Why not read it directly from position a?
So what about:
  $content = implode("", file($userfile));

Anyway: You should initialize $i in any way, best with zero -> $i=0; before 
the while loop.
You check if 0.tab 1.tab 2.tab; if 2.tab exists, you create 3tab (A dot seems 
to be missing) $destfile .= '.tab'; instead of $destfile .= "tab";

Is this script executed on unix? That would clearify why it could not find 
C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT :-)

--Sascha

Am Sonntag, 13. Oktober 2002 12:15 schrieb [EMAIL PROTECTED]:
> I posted "User Upload" and with no advice I attempted to use the sources i
> could find and came up with the following:
>
> while (file_exists("$i.tab")) {
> $i ++;
> }
> $destfile = $i;
> $destfile .= "tab";
> stripslashes($userfile);
> copy($userfile, "/uploads/" . $destfile);
> chdir("/uploads");
> $lines = file($destfile);
> $content = implode("", $lines);
> unlink($destfile);
> echo("$userfile_name");
>
> It doesnt work (surprise, surprise), what im trying to do is upload the
> file to my /uploads/ directory then read it and store it on the $content
> variable, then the content variable inserts a row into db (allready done),
> then I delete the file the while loop is to make sure I dont overwrite the
> file and make an error in my database.
>
> The errors PHP returns are:
>
> Warning: Unable to open 'C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT' for
> reading: No such file or directory in /home/tabzilla/public_html/doadd.php
> on line 89
>
> Warning: ChDir: No such file or directory (errno 2) in
> /home/tabzilla/public_html/doadd.php on line 90
>
> Warning: file("tab") - No such file or directory in
> /home/tabzilla/public_html/doadd.php on line 91
>
> Warning: Bad arguments to implode() in /home/tabzilla/public_html/doadd.php
> on line 92
>
> Warning: unlink() failed (No such file or directory) in
> /home/tabzilla/public_html/doadd.php on line 93
>
>
> ANY HELP? ANYONE???


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




Re: [PHP] Upload Problem

2002-10-13 Thread Chris Hewitt

[EMAIL PROTECTED] wrote:

>
>Warning: Unable to open 'C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT' for
>reading: 
>
Has the webserver got permission to read this file? It does not seem to 
be under the document root.

>No such file or directory in /home/tabzilla/public_html/doadd.php
>on line 89
>
Is line 89 in the code you posted, if so please mark it. I suggest 
echoing the value of any variables so that you can check that they 
contain exactly what you think they do.

>Warning: Bad arguments to implode() in /home/tabzilla/public_html/doadd.php
>on line 92
>
Possibly because the file was not opened/found.

HTH
Chris


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




[PHP] Upload Problem

2002-10-13 Thread tony

I posted "User Upload" and with no advice I attempted to use the sources i
could find and came up with the following:

while (file_exists("$i.tab")) {
$i ++;
}
$destfile = $i;
$destfile .= "tab";
stripslashes($userfile);
copy($userfile, "/uploads/" . $destfile);
chdir("/uploads");
$lines = file($destfile);
$content = implode("", $lines);
unlink($destfile);
echo("$userfile_name");

It doesnt work (surprise, surprise), what im trying to do is upload the file
to my /uploads/ directory then read it and store it on the $content
variable, then the content variable inserts a row into db (allready done),
then I delete the file the while loop is to make sure I dont overwrite the
file and make an error in my database.

The errors PHP returns are:

Warning: Unable to open 'C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT' for
reading: No such file or directory in /home/tabzilla/public_html/doadd.php
on line 89

Warning: ChDir: No such file or directory (errno 2) in
/home/tabzilla/public_html/doadd.php on line 90

Warning: file("tab") - No such file or directory in
/home/tabzilla/public_html/doadd.php on line 91

Warning: Bad arguments to implode() in /home/tabzilla/public_html/doadd.php
on line 92

Warning: unlink() failed (No such file or directory) in
/home/tabzilla/public_html/doadd.php on line 93


ANY HELP? ANYONE???


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




Re: [PHP] upload problem...

2002-05-22 Thread Jas

Yeah I tried that as well, no dice, however here is what I the code that DID
work.  Hope this helps anyone that is trying to accomplish much of the same.
Jas
 wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Wednesday 22 May 2002 07:02, Jas wrote:
> > Ok here is my error message:
> > Warning: Unable to open '' for reading: No such file or directory in
> > upload_done.php on line 9
> >
> > I have checked permissions on the folder and they are correct, my only
> > guess is that upon doing several checks, session vars, etc... it is
loosing
> > the file name somewhere.
>
> Try modelling your code on the example in the manual.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> sticktion
> */
>



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




Re: [PHP] upload problem...

2002-05-21 Thread Jason Wong

On Wednesday 22 May 2002 07:02, Jas wrote:
> Ok here is my error message:
> Warning: Unable to open '' for reading: No such file or directory in
> upload_done.php on line 9
>
> I have checked permissions on the folder and they are correct, my only
> guess is that upon doing several checks, session vars, etc... it is loosing
> the file name somewhere.

Try modelling your code on the example in the manual.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
sticktion
*/


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




Re: [PHP] upload problem...

2002-05-21 Thread Jas

Ok that didn't work, so far if I select a file other than a .jpg it returns
me an error which is what I need to happen, however if I select an image
with a .jpg extension for upload it tells me the upload was successful but
when I check the directory there is never anything there.  Any other ideas?
thanks in advance,
Jas
"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Take a look at move_uploaded_file()
> http://www.php.net/manual/en/function.move-uploaded-file.php
>
> Jas wrote:
>
> >Ok here is my error message:
> >Warning: Unable to open '' for reading: No such file or directory in
> >upload_done.php on line 9
> >
> >I have checked permissions on the folder and they are correct, my only
guess
> >is that upon doing several checks, session vars, etc... it is loosing the
> >file name somewhere.
> >Any help would be great!  Thanks in advance,
> >Jas
> >
> > >session_start();
> >if (isset($HTTP_SESSION_VARS['u_n']) || isset($HTTP_SESSION_VARS['p_w']))
{
> > if ($img1 = "") {
> >  $error_null = "You did not select a file to upload. >href='upload_a.php'><< back"; }
> > elseif (!eregi('.jpg$', $img1_name)) {
> >  $error_msg = "You tried to upload an invalid image.  File must be a
jpg
> >file type.<< back"; }
> > elseif (eregi('.jpg$', $img1_name)) {
> >  copy("$img1", "/images/$img1_name"); // this is line 9 and my error!
> >  $main = "Your file has been uploaded. If you need to make more changes
> >please select the page from the menu and follow the instructions."; }
> > } else {
> > header ("Location: index.php");
> > }
> >?>
> >
> >
> >
> >
> >
>
>



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




Re: [PHP] upload problem...

2002-05-21 Thread Gerard Samuel

Take a look at move_uploaded_file()
http://www.php.net/manual/en/function.move-uploaded-file.php

Jas wrote:

>Ok here is my error message:
>Warning: Unable to open '' for reading: No such file or directory in
>upload_done.php on line 9
>
>I have checked permissions on the folder and they are correct, my only guess
>is that upon doing several checks, session vars, etc... it is loosing the
>file name somewhere.
>Any help would be great!  Thanks in advance,
>Jas
>
>session_start();
>if (isset($HTTP_SESSION_VARS['u_n']) || isset($HTTP_SESSION_VARS['p_w'])) {
> if ($img1 = "") {
>  $error_null = "You did not select a file to upload.href='upload_a.php'><< back"; }
> elseif (!eregi('.jpg$', $img1_name)) {
>  $error_msg = "You tried to upload an invalid image.  File must be a jpg
>file type.<< back"; }
> elseif (eregi('.jpg$', $img1_name)) {
>  copy("$img1", "/images/$img1_name"); // this is line 9 and my error!
>  $main = "Your file has been uploaded. If you need to make more changes
>please select the page from the menu and follow the instructions."; }
> } else {
> header ("Location: index.php");
> }
>?>
>
>
>
>  
>



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




[PHP] upload problem...

2002-05-21 Thread Jas

Ok here is my error message:
Warning: Unable to open '' for reading: No such file or directory in
upload_done.php on line 9

I have checked permissions on the folder and they are correct, my only guess
is that upon doing several checks, session vars, etc... it is loosing the
file name somewhere.
Any help would be great!  Thanks in advance,
Jas

You did not select a file to upload.<< back"; }
 elseif (!eregi('.jpg$', $img1_name)) {
  $error_msg = "You tried to upload an invalid image.  File must be a jpg
file type.<< back"; }
 elseif (eregi('.jpg$', $img1_name)) {
  copy("$img1", "/images/$img1_name"); // this is line 9 and my error!
  $main = "Your file has been uploaded. If you need to make more changes
please select the page from the menu and follow the instructions."; }
 } else {
 header ("Location: index.php");
 }
?>



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




RE: [PHP] Upload problem

2002-04-11 Thread Johnson, Kirk

Try putting a hidden field like below in your form. Set the value (bytes) to
the size you want to be able to upload:



Kirk

> -Original Message-
> From: Frédéric Mériot [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 11, 2002 1:48 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Upload problem
> 
> 
> Hi All, it's my first post here.
> 
> I've got a problem with the upload. I want to upload a 4Mo file on the
> server but it refuses to work. I modified the max_upload_size 
> in the php.ini
> but it continues to refuse the transfer. If I upload a 
> smaller file it works
> fine.
> 
> Someone told me to modify the MAX_FILE_SIZE constant but I 
> don't find it.
> 
> I need help, Thanks
> 
> Fred from Paris

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




[PHP] Upload problem

2002-04-11 Thread Frédéric Mériot

Hi All, it's my first post here.

I've got a problem with the upload. I want to upload a 4Mo file on the
server but it refuses to work. I modified the max_upload_size in the php.ini
but it continues to refuse the transfer. If I upload a smaller file it works
fine.

Someone told me to modify the MAX_FILE_SIZE constant but I don't find it.

I need help, Thanks

Fred from Paris


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




RE: [PHP] [PHP Upload] problem

2002-03-26 Thread Jaeggi David

> I got this:
> 
> Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': 
> Permission denied
> in c:\Inetpub\webpub\PHP\upload.php on line 3
> Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': 
> Permission denied
> in c:\Inetpub\webpub\PHP\upload.php on line 4
> Warning: Unable to move 'C:\WINDOWS\TEMP\php187.tmp' to
> 'C:\Inetpub\webpub\PHP\upload' in 
> c:\Inetpub\webpub\PHP\upload.php on line 4
> 


Hi!

Make sure you're ok with the filerights in your nt-filesystem. i never tried
it but i think the "IWAM_[Servername]"-User must have write access in the
Upload-folder.

good luck!
dave

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




[PHP] [PHP Upload] problem

2002-03-26 Thread Evan

When running this code:


..









..
I got this:

Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': Permission denied
in c:\Inetpub\webpub\PHP\upload.php on line 3
Warning: Unable to create 'C:\Inetpub\webpub\PHP\upload': Permission denied
in c:\Inetpub\webpub\PHP\upload.php on line 4
Warning: Unable to move 'C:\WINDOWS\TEMP\php187.tmp' to
'C:\Inetpub\webpub\PHP\upload' in c:\Inetpub\webpub\PHP\upload.php on line 4

I must leave "register_globals=Off" !!!
Can anyone help?
Thanks,
Evan



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




[PHP] upload problem...

2002-02-18 Thread Cristiano Canobbio

hi my name is Cristiano and I've a question:

why the function "is_uploaded_file" return "1"?

my example file is index.php

thanks

FUNZIONE is_uploaded_file (è un boolean 0 - vero, 1 - falso)-->
".is_uploaded_file ($userfile);
}

echo ""
.""
.""
."File: "
;

echo ""
.""
.""

."clear form"
;
?>



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




Re: [PHP] upload problem

2001-11-29 Thread Andrey Hristov

var_dump($HTTP_POST_FILES);

HTH
Andrey Hristov
- Original Message - 
From: "Miguel Loureiro" <[EMAIL PROTECTED]>
To: "php-gen" <[EMAIL PROTECTED]>
Sent: Thursday, November 29, 2001 6:04 PM
Subject: [PHP] upload problem


> Hello all,
> when I want to do an upload ( form ENCTYPE="multipart/form-data"
> action=" . $PHP_SELF . " method="post">), sometimes ( having in form,
> several input file types, ex.:), after
> submit , dont show me the values uploaded ( aa_name ; aa_type) ?? Any
> ideas why ?
> thanks for your time...
> --
> Best Regards
> Miguel Joaquim Rodrigues Loureiro
> 
> 
> 





> -- 
> 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] upload problem

2001-11-29 Thread Miguel Loureiro

Hello all,
when I want to do an upload ( form ENCTYPE="multipart/form-data"
action=" . $PHP_SELF . " method="post">), sometimes ( having in form,
several input file types, ex.:), after
submit , dont show me the values uploaded ( aa_name ; aa_type) ?? Any
ideas why ?
thanks for your time...
--
Best Regards
Miguel Joaquim Rodrigues Loureiro




-- 
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] Upload problem

2001-10-01 Thread Gede Gilijk

Dear PHPmania,

I am new to PHP and I start to write some script.

$folder = USER_ENV(ID_user);
// echo $folder;
$destination = "/home/gilijk/data/".$folder;
// echo $destination;

if ($filename1!="none") {
copy($filename1,$destination."/".$filename1_name);
echo "$filename1_name telah berhasil dikirim.";
}


The problem, when I run this script with ID_User ABC, the file uploaded to
/home/gilijk/data/namafile.xtc
not to
/home/gilijk/data/ABC/namafile.xtc 
as I expected.

The script works if I use hardcode :
$destination = "/home/gilijk/data/ABC";

When I try to echo $folder and $destination, both works ok.
echo $folder; (output ABC)
echo $destination ; (ouput /home/gilijk/data/ABC )

Thanks for any help !

Gilijk





-- 
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] Upload Problem

2001-05-21 Thread Feroze Md. Arif

Hi,

I wrote a small upload script (using http) to upload various files to a
website.  I am able to upload jpg and gif files but I am unable to upload
tif files.  This seems strange.  Could anyone please let me know what I am
missing out on?  I have checked the mime.types file of apache and i saw the
entry for tif files there.

The server that I am uploading is a Cobalt Cube 2, Apache 1.3.3 Cobalt, PHP
4.0.5.  PHP has been compiled as a dynamic loadable module with apxs, ftp,
mysql etc.

I hope that someone will be able to help me.

Best Regards
Feroze

Jar Jar Binks will be Jedi!


-- 
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] upload problem (uid)

2001-04-11 Thread b0ld b0lb

here is the error:
Warning: SAFE MODE Restriction in effect. The script whose uid is 522 is not 
allowed to access /tmp/phpupload/phptQdi31 owned by uid 0 in 
upload_in_imgs.php3 on line 127


>From: Rasmus Lerdorf <[EMAIL PROTECTED]>
>To: b0ld b0lb <[EMAIL PROTECTED]>
>CC: <[EMAIL PROTECTED]>
>Subject: Re: [PHP] upload problem (uid)
>Date: Tue, 10 Apr 2001 16:15:48 -0700 (PDT)
>
>Are you sure it is uid 0?  Unless your Apache is running as root it should
>be getting uploaded as the web server uid id.  Use the
>move_uploaded_file() function to move the file into place.
>
>-Rasmus
>
>On Wed, 11 Apr 2001, b0ld b0lb wrote:
>
> > Hi,
> >
> > if i upload via http the tempfile is written with uid 0 (root). After 
>that i
> > cant do anything with the file because the php user is not allowed to. 
>Why
> > is my uploaded file owned by root, and how do i solve that?
> >
> > PS. phpinfo shows that the apache user is nobody
> >
> > thx, b0ld
> >
> >
> > 
>_
> > Get Your Private, Free E-mail from MSN Hotmail at 
>http://www.hotmail.com.
> >
> >
> > --
> > 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]
>

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
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] upload problem (uid)

2001-04-10 Thread Rasmus Lerdorf

Are you sure it is uid 0?  Unless your Apache is running as root it should
be getting uploaded as the web server uid id.  Use the
move_uploaded_file() function to move the file into place.

-Rasmus

On Wed, 11 Apr 2001, b0ld b0lb wrote:

> Hi,
>
> if i upload via http the tempfile is written with uid 0 (root). After that i
> cant do anything with the file because the php user is not allowed to. Why
> is my uploaded file owned by root, and how do i solve that?
>
> PS. phpinfo shows that the apache user is nobody
>
> thx, b0ld
>
>
> _
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> --
> 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] upload problem (uid)

2001-04-10 Thread b0ld b0lb

Hi,

if i upload via http the tempfile is written with uid 0 (root). After that i 
cant do anything with the file because the php user is not allowed to. Why 
is my uploaded file owned by root, and how do i solve that?

PS. phpinfo shows that the apache user is nobody

thx, b0ld


_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
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]