?
Solved

Prevent certain data types from Attachment field

Posted on 2011-09-25
5
Medium Priority
?
328 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
[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
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

649 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