![](https://seccdn.libravatar.org/avatar/e1e85bc6d7839f17446b29622b6ac6c9.jpg?s=120&d=mm&r=g)
^M makes me suspicious of dos formatted content. shouldn't matter but u may want to try a file other than the one u using with unix line breaks.
From: "Robert C. Paulsen Jr." <paulsen@texas.net> To: Purple Shirt <purpleshirt@hotmail.com> CC: suse-linux-e@suse.com Subject: Re: [SLE] php/apache file upload Date: Mon, 28 May 2001 07:11:04 -0500
Thanks fror the reply. I tried moving the script to /usr/local/httpd/htdocs but I get the same error I gor before:
========================================================================= <br> <b>Warning</b>: Unable to open 'Content-Type: text/plain;^M name=\"sample.txt\"^M ^M here is the text of my sample file. ' for reading: No such file or directory in <b>/usr/local/httpd/htdocs/upload.php</b> on line <b>3</b><br> <p>Upload error</p> =========================================================================
(This time I have shown the same error messaeg, but as it appears if I do a "view source" in the browser and cut-and-paste from there.)
Still a mystery to me why the $userfie variable contains all that. Perhaps the ^M characters are a clue as to where it is coming from.
I also tried turning safe mode off (in php.ini) but it made no difference.
On Mon, May 28, 2001 at 04:23:32AM +0000, Purple Shirt wrote:
I tried it. I put it into /usr/local/httpd/htdocs and it works there as it has root permissions. I couldn't get it to go in user file space.
Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access /tmp/phpdOzA3b owned by uid 0 in /home/user/public_html/upload.php on line 7
Upload error
mk
From: "Robert C. Paulsen Jr." <paulsen@texas.net> To: suse-linux-e@suse.com Subject: [SLE] php/apache file upload Date: Sun, 27 May 2001 21:28:06 -0500
(I will be sending this same message to the php mailing list if my subscription request comes through. Until then, perhaps someone here can help.)
I am having trouble with file upload.
OS: Linux (SuSE 7.0) HTTP: Apache 1.3.19 PHP: 4.0.4pl1
I am using the technique I have seen in about there different books and on the php web page. The problem seems to be that the variable I thought was supposed to contain the name of the temp file where the file was uploaded contains quite a bit more. Here is the entire script and the output from running it:
=========================================================================
<?php
print "<html><body>";
if ( $submit=='upload') { $upfile='/home/robert/open/uploaded.txt'; if (copy($userfile,$upfile)) print '<p>Uploaded OK</p>'; else print '<p>Upload error</p>';
} else { print " <form enctype='multipart/form-data' action=$PHP_SELF method=post> <input type=hidden name=MAX_FILE_SIZE value=32768> Upload file: <input type=file name='userfile'> <input type=submit name=submit value=upload> "; }
print "</body></html>";
=========================================================================
When I use this script to attempt an upload here is what I see:
Warning: Unable to open 'Content-Type: text/plain; name=\"sample.txt\" here is the content of my sample file. ' for reading: No such file or directory in /home/robert/public_html/upload.php on line 7
Line 7 is the copy function.
It appears that the variable $userfile contains not only the name of my file but its contents as well. I verified this by adding the line:
print "$userfile"
And it prints:
Content-Type: text/plain; name=\"sample.txt\" here is the content of my sample file.
What am I missing?
"sample.txt" contains:
=========================================================================
here is the content of my sample file.
=========================================================================
-- ____________________________________________________________________ Robert Paulsen paulsen@texas.net
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq and the archives at http://lists.suse.com
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com
![](https://seccdn.libravatar.org/avatar/406f6e98c5b18ecd161d103cc5799c45.jpg?s=120&d=mm&r=g)
Well, I have tried many files. The one I gave here was just to demonstrrate the problem I am having in a much larger context. The real question is not "why are there DOS line breaks?" but "why does the variable contain anything at all, beyond a simple file name?" On Mon, May 28, 2001 at 12:51:02PM +0000, Purple Shirt wrote:
^M makes me suspicious of dos formatted content. shouldn't matter but u may want to try a file other than the one u using with unix line breaks.
From: "Robert C. Paulsen Jr." <paulsen@texas.net> To: Purple Shirt <purpleshirt@hotmail.com> CC: suse-linux-e@suse.com Subject: Re: [SLE] php/apache file upload Date: Mon, 28 May 2001 07:11:04 -0500
Thanks fror the reply. I tried moving the script to /usr/local/httpd/htdocs but I get the same error I gor before:
========================================================================= <br> <b>Warning</b>: Unable to open 'Content-Type: text/plain;^M name=\"sample.txt\"^M ^M here is the text of my sample file. ' for reading: No such file or directory in <b>/usr/local/httpd/htdocs/upload.php</b> on line <b>3</b><br> <p>Upload error</p> =========================================================================
(This time I have shown the same error messaeg, but as it appears if I do a "view source" in the browser and cut-and-paste from there.)
Still a mystery to me why the $userfie variable contains all that. Perhaps the ^M characters are a clue as to where it is coming from.
I also tried turning safe mode off (in php.ini) but it made no difference.
On Mon, May 28, 2001 at 04:23:32AM +0000, Purple Shirt wrote:
I tried it. I put it into /usr/local/httpd/htdocs and it works there as it has root permissions. I couldn't get it to go in user file space.
Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access /tmp/phpdOzA3b owned by uid 0 in /home/user/public_html/upload.php on line 7
Upload error
mk
From: "Robert C. Paulsen Jr." <paulsen@texas.net> To: suse-linux-e@suse.com Subject: [SLE] php/apache file upload Date: Sun, 27 May 2001 21:28:06 -0500
(I will be sending this same message to the php mailing list if my subscription request comes through. Until then, perhaps someone here can help.)
I am having trouble with file upload.
OS: Linux (SuSE 7.0) HTTP: Apache 1.3.19 PHP: 4.0.4pl1
I am using the technique I have seen in about there different books and on the php web page. The problem seems to be that the variable I thought was supposed to contain the name of the temp file where the file was uploaded contains quite a bit more. Here is the entire script and the output from running it:
=========================================================================
<?php
print "<html><body>";
if ( $submit=='upload') { $upfile='/home/robert/open/uploaded.txt'; if (copy($userfile,$upfile)) print '<p>Uploaded OK</p>'; else print '<p>Upload error</p>';
} else { print " <form enctype='multipart/form-data' action=$PHP_SELF method=post> <input type=hidden name=MAX_FILE_SIZE value=32768> Upload file: <input type=file name='userfile'> <input type=submit name=submit value=upload> "; }
print "</body></html>";
=========================================================================
When I use this script to attempt an upload here is what I see:
Warning: Unable to open 'Content-Type: text/plain; name=\"sample.txt\" here is the content of my sample file. ' for reading: No such file or directory in /home/robert/public_html/upload.php on line 7
Line 7 is the copy function.
It appears that the variable $userfile contains not only the name of my file but its contents as well. I verified this by adding the line:
print "$userfile"
And it prints:
Content-Type: text/plain; name=\"sample.txt\" here is the content of my sample file.
What am I missing?
"sample.txt" contains:
=========================================================================
here is the content of my sample file.
=========================================================================
-- ____________________________________________________________________ Robert Paulsen paulsen@texas.net
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq and the archives at http://lists.suse.com
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq and the archives at http://lists.suse.com
-- ____________________________________________________________________ Robert Paulsen paulsen@texas.net
participants (2)
-
Purple Shirt
-
Robert C. Paulsen Jr.