Attaching a file from users machine to then mail?

They have: 16 posts

Joined: May 2000

I am using formail to send the results of a form to me.
However I need to be able to get the user to attach a file to waht they send. Does anyone know of how I can do this without using an Upload tool. I have available to me CDONTS and formail.

If I use the HTML this will give me the path on the users pc but CDONTS will think that this is actually on the server itself. If I'm wrong or if anyone has a suggestion please help!!!!!

Thanks.

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

I'm not quite sure what you are after, but it seems like the upload tool would need to be used (I could be wrong though). The only other way I know is to have them e-mail you directly and attach the file, which of course is not at all what you want... Sad

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

Regarding:

Quote:
...CDONTS will think that this is actually on the server itself. If I'm wrong...

does this mean you tried it? If not, then try it.
Not being familiar with CDONTS, I can't really comment on what it can and cannot do. However, if your current cgi programs do not allow for attaching files, you'll have to get another -- http://www.cgi-resources.com. Also, I would be wary of allowing people to upload/attach files. In other words, I'd use a program that checks the file for binary content first and if it exists, rejects it. (Unless of course if you like playing the virus version of Russian Roulette Smiling

Vinny

Where the world once stood
the blades of grass cut me still

They have: 16 posts

Joined: May 2000

I have asked my host for an upload utility, so hopefully this will do the trick (if he puts it in place!!!).

Also Vinny, how could I check it for binary data in case of virus's. Any good resource sites on the matter would be good.

Thanks.

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi purplepages,

This will have to be general since I don't know what type of files you expect to upload.
1) you could check file extensions -- If you are expecting *.txt or *.doc and someone's trying to upload *.exe cancel the process. (Doesn't stop someone from renaming virusX.exe virusX.doc, though)
2) you could open & read the file; if it contains anything other than ascii characters in the alphanumeric range, cancel the process. This implies you need a cgi program that is capable of reading files. You could also use the program to check the file size and reject anything over, say, 30 megabytes Smiling
3) if you are allowing gifs, jpgs, etc, you could get a cgi program to read the header information if it doesn't jive with the appropriate data, cancel the operation.

check out http://www.cgi-resources.com for possibilities

Vinny

Where the world once stood
the blades of grass cut me still

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.