Solved

PHP handle file upload

Posted on 2011-09-29
4
322 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
Comment Utility
Otherwise, you can validate through javascript before you start upload process.
0
 

Author Comment

by:liyy
Comment Utility
thanks logudotcom,

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

Accepted Solution

by:
Loganathan Natarajan earned 125 total points
Comment Utility
Just ref these,

sample 1

sample 2
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
Comment Utility
you can also google, "check file extension in javascript before upload"
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

744 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

15 Experts available now in Live!

Get 1:1 Help Now