Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 574
  • Last Modified:

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; ?>')

Thanks in advance
  • 3
1 Solution
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.
ZumbaJrAuthor Commented:
I've requested that this question be deleted for the following reason:

It's wrong
Gurvinder Pal SinghCommented:
Kindly explain the reason in detail, or I will have to object to your request.
Gurvinder Pal SinghCommented:
saying "its wrong" and closing the question is not right. Please explain why are you closing the answer
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.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now