Chetan Sharma
Chetan Sharma

Reputation: 2557

How can if find the size of a file prior to upload, with the help of jquery?

I want to check the file size before uploading it, so that i can restrict the users before uploading. I want it use the jquery, but please suggest some thing else, if it is not possible in that way. I am using PHP at backend.

Upvotes: 0

Views: 178

Answers (4)

Pekka
Pekka

Reputation: 449435

You can't with Javascript, but you can using a Flash based uploader such as SWFUpload.

Upvotes: 1

TheHippo
TheHippo

Reputation: 63139

This is not possible via JavaScript. You could try to use any kind of browser plugin to perform these test. FlashPlayer offers these kind of possibilities.

Upvotes: 0

BalusC
BalusC

Reputation: 1108722

You cannot. It's a security restriction in Javascript/HTML. Best what you can do is to use a real programming language for which you can write client-side applications which you on its turn can embed in a web page, such as a (signed!) Java Applet or Java Web Start (aka JNLP).

Upvotes: 0

Deniss Kozlovs
Deniss Kozlovs

Reputation: 4841

You can't check file size with Javascript. This is a security restriction. The only way you can do it is only using server-side scripting.

Upvotes: 3

Related Questions