Hi I run an internal site site to organise o开发者_如何学JAVAur company events. I want a user to be able to send an email using php. The script is obviously on my server. When the user has has completed the email I want to pick up the email signature (HTML file) from the users own pc on a c drive and then include it in the mail program on my server . I have included a short bit of the code. I don't expect anybody to write code for me but can somebody help me get the right path to the users C drive. Thanks in advance
$msg = "<h3>Test Email signature</h3> " ;
$msg .= file_get_contents('C/Intranet/signatures/sig1.htm');
$email = new emailer;
$email->subject = $type ;
$email->body = $msg ;
$email->from = "mwl707@googlemail.com" ;
$email->to = "mwl707@googlemail.com" ;
$email->sendmail() ; enter code here
The users PC ==> Client PC
There is no way you can get to the users "C:" drive by using the php script on the server. php (server side scripting language) works on the server.
You have to use a client side script (javascript) to do something on the clients computer.
That too has limitations.
You cannot get beyond the document space ... using that script even.
document << browser window << browser program << os
You have to ask the os for the file ... which is not possible with javascript except in cases where the user is uploading a file
PHP is a server-side language. All the code you write basically relates to location on the server's drives. You cannot have access to a user's hard drive because:
- The code doesn't run on their machine... It runs on the server.
- The browser does not give any facilities to access random files on a user's computer.
When your users connect to the intranet, they request the server to send a page over. The server then executes the code on that page and returns the HTML requires to display the page in the user's browser. The browser then renders the page to your specification.
You PHP code is executed on the server. It cannot be run on the client's computer.
精彩评论