0

Im looking for a simple code for users on my webpage to upload a .doc or .txt file to my email address. I've only found ones in CGI which i can't use and the one i tried only send it in binary code and not the actual word doc. Does anyone have a simple code that I can use?

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by UWATANG
0

Upload to your email address? Hmmm.

You can have the user upload any file at all, by placing a file upload element on your page.

<input type="file">

There are some optional attributes, such as ID or NAME, and SIZE (referring to the size of the textbox, not the size of the file.

The form must be properly encoded to allow files to be posted, add the enctype="multipart/form-data" key-value pair to your FORM element.

Once it's on the server, you'd use whatever server-side language you use to process the file, which could include emailing it somewhere.

0

I've done the coding of the basic form, (similar to above) tested it and got the email through correctly, but the file I was trying to upload didn't come with it. Do I have to put anything on the server to actually have the file come through?

Any help appreciated.

0

I have never used PHP before, but I think the answer lies in me learning how that works! I got a PHP script to send a file to a server. Brilliant for a beginner! But now I want to put a message from a form together with an uploaded file, and have both the form message and the file sent to an email address. I also want to restrict the size of the file being uploaded and make it only a word doc or pdf. Any advice appreciated. Thanks tgreer for the ID attributes tip.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.