?
Solved

CFPOP Attachments

Posted on 2004-10-01
9
Medium Priority
?
520 Views
Last Modified: 2013-12-24
Hi all, I was wonder if someone can help me out with a problem.  I am setting up a standard CFPOP page to display a users email. I was wondering if there was any way to store the users email attachment that they receive and insert it into a SQL Database.  The final goal is to log all emails incoming and outgoing.  I figured I would use SQL2000 To store all email info this way everything can be easily searched thru by date or user and so on.  I am just lost on what to do with the attachment itself, should I store them in a database as Binary, not sure and some help or Ideas would greatly be appreciated.  I am also open to storing all attachments in a folder, I just need a way to link them to the Database Record.  Thanks for your time
0
Comment
Question by:joebox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 12202984
If you stored then in a folder then just store the path to the folder in the database record.  You can use cffile's attributes to get the path to where the attachment was saved....
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12203156
Hi joebox,
1) it is good idea to store images into the folder. My company does that. We have images with their unique name in the database.

Sample database example:
1) nameoftheoriginalfile
2) modifiedfilename
3) datetimeinserted
4) pathstored

now we store all the files in the different folder for our usage. Well whatever the file is uploaded we rename those file with the applicationid and currenttimewithyr so it has now new uniquename.

We also save the current filename inthe database field. This is the way we have optimized our system. My company is one of the largest in USA to serve the images. That is really good as my company is not in porn business and we have so many hits.

Regards,
---Pinal
0
 

Author Comment

by:joebox
ID: 12222390
I like both answers and is how i propably would have done it.  I was just curious as to if there was any benefits of storing as binary in a database, but I guess not cause noone suggested it.  Doing it the way you guys say with cffile is there anyway to only accept certain attachment extensions.  For instance not to accept any attachments with a .exe file type???  I will probably split the points with you guys unless one of you can pull thru with this answer I will also add points to it.  thanks again for all your help and ideas....  Joe
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 21

Expert Comment

by:pinaldave
ID: 12222430
sure, what you can do is specify what kind of mime type you want to upload. It is associated iwth your CFfile and you can specify what kind of file extention you want to upload.
<cffile
   action = "upload"
   fileField = "formfield"
   destination = "full_path_name"
   nameConflict = "behavior"
   accept = "mime_type/file_type"
   mode = "permission"
   attributes = "file_attribute_or_list">
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p35.htm#wp3540091

Limits the MIME types to accept. Comma-delimited list. For example, to permit JPG and Microsoft Word file uploads:

accept = "image/jpg, application/msword"

The browser uses file extension to determine file type.


Regards,
---Pinal
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12222565
Watch out for the accept string PinalDave mentioned.  

It is buggy and for example
accept = "image/jpg" will not allow jpeg images sent from a mac.

Personally, I would save ALL attachements.

But when displaying since you know the name of the attachment - including filetype - do not allow the user to access any restricted extention types.  Instead display a message saying something like :

Filename : XXXXXXXXXXXX.exe is a restricted filetype.  Access Denied.

This way also saves you in the case that the director/manager comes and says "I need that file".  You can then recover it on a case-by-case basis, but you prevent the majority which are not legit, but most likely viruses.
0
 

Author Comment

by:joebox
ID: 12222890
mrichmon-
can you elabortate a little more, i think I like your approach better.  So what your saying is to save all attachents to a folder and when the user views thier mail, if that mail has an attachemnt with an .exe then just dont display it in thier mail message.
So once the file name is written to Database then I could do a plain <cfif mail.attachment contains "exe"> then dont display.  Is this kind of where you are going..... joe
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 2000 total points
ID: 12227561
Yes.

I assume that in your example mail is the query name?

If so then that is the exact kind of logic.

Something like:


<cfset restrictedfiles = "exe,scr,bat">

<cfloop index="attachment" list="attachmentlist">
   <cfloop index="extension" list="restrictedfiles">
       <cfif FindNoCase(extension, attachment)>
            Access is restricted to the attachment named: <cfoutput>#attachment#</cfoutput> because it is of a restricted filetype
        <cfelse>
            Display attachment or link to attachement
        </cfif>
    </cfloop>
</cfloop>
0
 

Author Comment

by:joebox
ID: 12235465
thanks so much for your help.....
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12238398
no problem :o)
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
What You Need to Know when Searching for a Webhost Provider
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question