Solved

Prevent certain data types from Attachment field

Posted on 2011-09-25
5
265 Views
Last Modified: 2012-05-12
Hello experts ,
is there any way to prevent user from uploading certain data types to the attachment field? i want to insert only picture files and reject all other file types supported by the attachment field by showing a warning message.
How can this be achieved?
0
Comment
Question by:stathisx
  • 4
5 Comments
 
LVL 10

Expert Comment

by:Tony Barkdull
ID: 36596039
In you file upload, use this to specify type and size. This is from my asp page

'The the properties of the upload
File.ValidFileTypes = "jpg,gif,png"
File.MaxSize = 1024*1024
File.Overwrite = false 'Do not overwrite, create unique filename
0
 
LVL 1

Assisted Solution

by:stathisx
stathisx earned 0 total points
ID: 36596065
there is no such property in the attachment field !
0
 
LVL 1

Assisted Solution

by:stathisx
stathisx earned 0 total points
ID: 36596079
there is .filetype that may be used in vba to control which data types should be allowed ( just a thought)
0
 
LVL 1

Accepted Solution

by:
stathisx earned 0 total points
ID: 36596164
i found the solution :

Private Sub uploadpath_BeforeUpdate(Cancel As Integer)
If Me.uploadpath.FileType <> ".jpg" Or Me.uploadpath.FileType <> ".png" Or Me.uploadpath.FileType <> ".jpeg" Then
MsgBox "denied attachment"
Cancel = True
End If
End Sub

it does the job :)
0
 
LVL 1

Author Closing Comment

by:stathisx
ID: 36890339
i found that the filedata property for the attachment field does what i really wanted. so in before update event of the attachment field a used this code to validate the attachment uploaded and if does not meet my criteria to reject it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now