Write binary data to file in javascript (like image file)

Is there a way to write binary data to local disk files in javascript like image files?

I try it but it works only for txt files:

                                    var fp = fopen('image.jpg', 3);
                                    fwrite(fp, '<?php echo $contents; ?>')
                                    fclose(fp);

Thanks in advance
Zumba
ZumbaJrAsked:
Who is Participating?
 
Gurvinder Pal SinghCommented:
In short, you cannot save a file using javascript on client side.

You need to invoke server-side script to save this on server side.
0
 
ZumbaJrAuthor Commented:
I've requested that this question be deleted for the following reason:

It's wrong
0
 
Gurvinder Pal SinghCommented:
Kindly explain the reason in detail, or I will have to object to your request.
0
 
Gurvinder Pal SinghCommented:
saying "its wrong" and closing the question is not right. Please explain why are you closing the answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.