Automatically attaching and emailing a zipped file to PHP with no User input
I have a program I wrote that when it has an error, it saves infomation of the error in a zip file in their TEMP directory, and then opens their browser to my PHP file.
I want the PHP file to automatically go to a specific location (their temp zip) that will be passed via HTTP POST arguments and attach the 开发者_开发知识库zip folder to an email to myself. It should be noted that my mail() command is connected to an google SMTP server.
Can this be done?
If not, what do you suggest as an alternative. I suppose I could pass the binary data as a HTTP Post and then have PHP recreate the zip? All ideas are welcomed.
I'm not sure you can do that via the browser - no browser can upload a file without users' consent - that's insecure and hence it is not allowed.
You could rather try making a connection to the server, not open the web page on your server, from your software and upload the file that way - cURL would be the method of choice I think - it has plenty of implementations in most programming languages so it shouldn't be a problem. Just try searching for "upload a file with curl" on google.
精彩评论