Re: [PHP] File access from another machine
hi, how about RCP,SCP, SFTP or FTP or worse comes to worse NFS Harish wrote: Hello All, Is there any possibility to open a file in another machine, provided the IP of the machine using PHP scripts. I only need to open a file with the format abc190104.csv in another machine & write data into that file. Or to steam it through the HTTP. Regards Harish Rao K -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file access to "virtual files"
On Monday 09 February 2004 16:23, merlin wrote: > there is following scenario: > - One php file saved with .pdf extension > - .htaccess tells php to parse this file > - ?ID=x provides the database id for individual files > > That whole thing workes perfectly as long as you access it via browser > and URL. > > Now I need to save those files, or send them as an email attachement. > I am using a phpmailer class. When I try to access the file with the ? > and parameters email transaction failes. > > $mail->AddAttachment('/invoice-sample.pdf?id='.$sl[ID], "invoice.pdf"); That is telling php to get the file '/invoice-sample.pdf?id=XXX...' through the local filesystem, ie not through HTTP, and as such it will not be parsed/interpreted by php. > Has anybody an idea how to solve this or where the problem lives? You need to open the file through HTTP, whether you can do that depends on your version of PHP and the platform it's running on. If the phpmailer class can handle the opening of files via HTTP then it should be a simple: $mail->AddAttachment('http://www.yourwebserver.com/invoice-sample.pdf?id='.$sl[ID], "invoice.pdf"); Otherwise you need to manually read in the file then feed it into $mail->AddAttachment (somehow) So something like: fopen('http://www.yourwebserver.com/invoice-sample.pdf?id='.$sl[ID], 'r'); along with your favourite file reading function. -- 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 -- /* Nothing is so often irretrievably missed as a daily opportunity. -- Ebner-Eschenbach */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File access denied!!!
You need to chmod o+r them (in the ftp client). Also the path must be readable by the web server. You might want to set up the ftp server to give these permisions automaticaly Joakim Larsson wrote: I am running a ftp server on my mac along with the webserver on OS 10.2. The files that i upload to the server i have no access to through the internet. This is the message i get when trying to access the webpage "You don't have permission to access /index.html on this server.". What do i do to get access to the files that i upload? Sincerely, Joakim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Access Rights
The error that I get is a "Permission Denied" Message !! --Puspinder On Wednesday, March 5, 2003, at 03:27 PM, Kevin Stone wrote: chmod($file, 0600); This sets the file to Owner read and write, Group nothing, Public nothing. If you're on a shared server then chances are this function has been disabled so you may have to FTP or SSH into your account and set the permissions for the file manually using the chmod command. Good luck. - Kevin - Original Message - From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 05, 2003 12:51 PM Subject: [PHP] File Access Rights Hello all My php script needs to read a text file that is stored in the same Dir as the php file. However I do not want to allow users to be able to see the contenst of the file from the Browser. Please suggest some remedy. Thanks in advance Pushpinder Singh Garcha _ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Pushpinder Singh Garcha _ Web Architect : www.MasterStream.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Access Rights
Thanks Kevin I have tried to chmod the file ...but I need to give others the permission to read the file...or the script itself cannot open the file ! --Pushpinder On Wednesday, March 5, 2003, at 03:27 PM, Kevin Stone wrote: chmod($file, 0600); This sets the file to Owner read and write, Group nothing, Public nothing. If you're on a shared server then chances are this function has been disabled so you may have to FTP or SSH into your account and set the permissions for the file manually using the chmod command. Good luck. - Kevin - Original Message - From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 05, 2003 12:51 PM Subject: [PHP] File Access Rights Hello all My php script needs to read a text file that is stored in the same Dir as the php file. However I do not want to allow users to be able to see the contenst of the file from the Browser. Please suggest some remedy. Thanks in advance Pushpinder Singh Garcha _ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Pushpinder Singh Garcha _ Web Architect : www.MasterStream.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Access Rights
chmod($file, 0600); This sets the file to Owner read and write, Group nothing, Public nothing. If you're on a shared server then chances are this function has been disabled so you may have to FTP or SSH into your account and set the permissions for the file manually using the chmod command. Good luck. - Kevin - Original Message - From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 05, 2003 12:51 PM Subject: [PHP] File Access Rights > > Hello all > > My php script needs to read a text file that is stored in the same Dir > as the php file. However I do not want to allow users to be able to see > the contenst of the file from the Browser. Please suggest some remedy. > > Thanks in advance > > > Pushpinder Singh Garcha > _ > > > -- > 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] File Access Rights
On Thursday 06 March 2003 03:51, Pushpinder Singh Garcha wrote: > My php script needs to read a text file that is stored in the same Dir > as the php file. However I do not want to allow users to be able to see > the contenst of the file from the Browser. Please suggest some remedy. If you're using apache you can use an directive to deny access to said file from being accessible by browsers. Deny from all -- 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 -- /* "Free markets select for winning solutions." -- Eric S. Raymond */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Access...
put this to the begining of your some.php if (eregi("some.php",$PHP_SELF)) { Header("Location: index.php"); die(); } Brian McGarvie wrote: >How could you redirect somone from directly accessing a file... > >Meaning... if an engine spiders www.domain.com/some.php > >How could you make some.php redirect to index.php > >However... the site is framed, and the menu uses content.php to display the >selected content. > >Any ideas? > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file access(mpeg) only for authenticated people
hi! I'm having some trouble with this. If i use an ftp address out of some reason I'm unable to read the file(although I get a handle).(ftp server supports passive mode) And if I use http(without authorisation) the browser still asks if I want to save it.(even if I use video/mpeg as Content-Type) and still displays the name of my php script instead of the mpeg when asking what I want to do. If I choose save it then displays the right filename. Thanks Thorsten Mukul Sabharwal <[EMAIL PROTECTED]> schrieb in im Newsbeitrag: [EMAIL PROTECTED] > Hey, > > Well sure there is: > > $fp = fopen($filename, 'r') or die('damn'); > $read = fread($fp, filesize($filename)) or > die('damn'); > $filestr = basename($filename); > > header("Content-Disposition: attachment; > filename=$filestr"); > header("Content-Type: application/octet-stream"); > > echo $read; > exit; > > Neat And Clean! > > Your authentication can be done above that piece of > code, you then open the file, read it through send the > filename download as $filestr, and the contents > $read. > > Simple! -- 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 access(mpeg) only for authenticated people
Hey, Well sure there is: $fp = fopen($filename, 'r') or die('damn'); $read = fread($fp, filesize($filename)) or die('damn'); $filestr = basename($filename); header("Content-Disposition: attachment; filename=$filestr"); header("Content-Type: application/octet-stream"); echo $read; exit; Neat And Clean! Your authentication can be done above that piece of code, you then open the file, read it through send the filename download as $filestr, and the contents $read. Simple! --- Thorsten Gutermuth <[EMAIL PROTECTED]> wrote: > Hi! > I'm trying to make some mpegs available only to > people who authenticated > themselves using php. But all the solutions I found > somewhat unpleasant > because I uses chmod to set the file attributes to > u=rw and then > used either > i) > readfile("ftp://name:password@server/path//test.mpeg"); > > or > > ii) header ("Location: > ftp://name:password@server/path/test.mpeg"); > > But in case > i) the browser asks if I want to download the file > or view it. If I choose > view the browser suggests to save the movie as > myscript.php and if I choose > view it ´doesn't display anything. > > ii.) the browser displayes my username and password > in the statusbar > > And in both cases it downloads the whole file(I > guess cause I use ftp) > before starting the mpeg programm(where nothing > happens afterwards in case > i) > > Is there a better way? ´Like telling the server via > http my login data and > sending the file to the users browser? > > Thanks > Thorsten > > > > > > -- > 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] > = To find out more about me : http://www.geocities.com/mimodit My bookmarks are available @ http://mukul.free.fr __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.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]