1

I searched a lot. Every time anyone asked about file uploading by jquery, as answers he got only some links of jquery plugin. Can anyone tell me why plugin is needed? why simple ajax is not working in this context?

Tuition is preferable than solution.

0

2 Answers 2

2

You can only upload files by posting the form that contains the file input. You can't upload files using AJAX.

The reason for this is security. A user can select a file to be uploaded, but the only thing that the Javascript code can do is to upload the file using a post, it can't access the file data or upload it any other way.

Sign up to request clarification or add additional context in comments.

3 Comments

With plugins like uploadify it is possible. or isn't it ajax?
@genesis: It uses a flash component. A component can access file data, but with just Javascript/jQuery it's not possible.
@Guffa - so where is the security when some one can upload files using flash component through JS?
0
$("input[type='file']").hide();

will hide input with file type.

7 Comments

@Abhishek: So you need plugin... no way
@Abhishek: because type isn't simple text, but binary data.
So whats there in those plugins? There is no way to handle binary data in ajax(jquery)?
@Abhishek: these plugins are shockwave/flash and they use another method
@Abhishek: The problem is not that it's binary data, the problem is that the Javascript code can't access the data.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.