Solved

PHP handle file upload

Posted on 2011-09-29
4
361 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
[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
  • 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 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