Solved

PHP handle file upload

Posted on 2011-09-29
4
331 Views
Last Modified: 2012-05-12
I am writing the PHP handle upload the file, how can I control the user only upload odt file, I know that using $_FILES["file"["type"] match "application/msword" to control the doc file, but seems no odt file extension control, any alternative way?

0
Comment
Question by:liyy
  • 3
4 Comments
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 36860155
Otherwise, you can validate through javascript before you start upload process.
0
 

Author Comment

by:liyy
ID: 36889987
thanks logudotcom,

is there any existing JavaScript code I can search?
0
 
LVL 36

Accepted Solution

by:
Loganathan Natarajan earned 125 total points
ID: 36890204
Just ref these,

sample 1

sample 2
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 36890205
you can also google, "check file extension in javascript before upload"
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

Suggested Solutions

Title # Comments Views Activity
Calculate values in an array 18 33
Mysql sync between 3-4 mysql db 4 24
datetime in sql 6 25
Before I get too far.. best way to save dates data 4 15
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

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

22 Experts available now in Live!

Get 1:1 Help Now