|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I want to create form mail which can attach file. What can I do so that it send attach to another mail. Please help me. |
|
#2
|
||||
|
||||
|
Go Play...
PHP Code:
Just copy this to a file and give it a name. The script was originally setup to accept only PDF files but I have modified it slightly so that it will accept multiple types of files. There are a few things you should edit: 1. The e-mail address's through out 2. The upload path, yes in this script the files must be uploaded 3. The FileTypes array should be modified to accept only files you want. At the moment it is setup to accept GIF or PDF files. 4. The MAX_FILE_SIZE to an appropriate size. HTH
__________________
--------------------- -- SilkySmooth -- --------------------- Proxy | Little Directory |
|
#3
|
|||
|
|||
|
Chapter 18. Handling file uploads at PHP manual.
|
|
#4
|
|||
|
|||
|
Thanks SilkySmooth,
I used your code and it run good but I don't know some variable in your code such as: $Headers.="X-Mailer: PHP4\n"; $Headers.="X-Priority: 3\n"; $Headers.="Return-Path: someone@domain.com\n"; $Headers.="This is a multi-part Contentin MIME format.\n"; What's purpose? Can you explain it for me?. Thanks alot and your dog 's very nice. I can take it. Bye |
|
#5
|
||||
|
||||
|
Hi,
The X-Mailer gives a name to your mailing process, for example if you used Outlook Express to send an e-mail it would likely put in this field, 'Outlook Express' so that others can identify the mailer. The X-Priority field sets the priority for applications such as Outlook, 3 is low, 2 is normal, 1 is important. (I think, it may be the opposite) so when the e-mail arrives with the 1 setting it will mark the e-mail in certain applications with a red exclamation mark. The Return Path is the e-mail where returns will be sent if a user was to click the reply button when reading your e-mail and the final one is just a statement to declare that the e-mail is not plain text. HTH |
|
#6
|
|||
|
|||
|
Thanks SilkySmooth,
Now I understand it clearly and I gone your website. Thanks a lot |
|
#7
|
||||
|
||||
|
No Problem
![]() |
|
#8
|
|||
|
|||
|
This is a great script that works like a charm, but I've got one small problem with it.... I want it to be able to accept various image types only, but I can't get anything besides gif to work. I've tried everything I can possibly think of to make jpeg work with it, and nothing works. Anyone have any ideas why?
|
|
#9
|
||||
|
||||
|
Hiya all ~
This script is great, thanks lots for posting it. I got it working on Linux server, no issues BUT now i need it running on a NT server. I installed PHP 4.3.3, created a directory that has all the permissions. I can now post using the script, but the file I receive cant open? It seems to be corrupt or something. I have tried the same filetypes from my Linux server (doc, pdf) and they open with no issues. The file sizes are correct as well when posting from the NT server - but they dont open? Do I need to install some extra modules with PHP for this script to run? Anybody got some ideas? Thanks! PS - I just noticed that the folder on the linux server keeps the uploaded files that was attached, and the NT server has no attached files inside. Could this have something to do ith it maybe?) Last edited by LotusHead : November 6th, 2003 at 10:09 AM. |
|
#10
|
||||
|
||||
|
Hey Lotus,
Glad you liked the work :-) A couple of things, yes it would make a difference if the file is not getting stored then it likely won't be able to mail it to you thus what you are receiving in the e-mail would just be a filename and no actual file. The first thing I would suggest is to check the permissions, ensure that the web users have access to the upload folder to put the documents. If this doesn't help you may also want to replace the move_uploaded_file() to copy() instead, you can find out info about both functions at the followings URL's. http://www.php.net/move_uploaded_file http://www.php.net/copy Sometimes reading through the comments can help because people post up their experiences with the functions on different servers etc. HTH |
|
#11
|
|||
|
|||
|
Help me
I used this code attach file and when I send mail without attach file but I recieved mail with an icon attach. What I do so that icon attach don't appear if I don't attach file.
Thanks a lot. |
|
#12
|
||||
|
||||
|
Quote:
You would need to add an if statement or two to modify the headers such that if there is no file being sent then it uses plain headers and if there is a file then it uses the headers as they are. |
|
#13
|
||||
|
||||
|
I have not read this thread, but I noticed something and my comment is general.
When sending emails, you may get a lot of errors with some SMTP servers if you do not use the standard "\r\n" line returns. For better compatibility, you should always use "\r\n" in your headers and content and not "\n". Good luck ![]()
__________________
© AZ AZbb :: AZ Bulletin Board - Secure BBS script, Front page CMS, Chat, No database Simple Guide to Apache and PHP installation on Windows |
|
#14
|
|
|
|