Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP handle file upload

Posted on 2011-09-29
4
Medium Priority
?
372 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 500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

722 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