2

I want to put a file into a QR code. I saw that there is an android app which does that Zapya

My question is how do they do it? Or how can I do it? From my searches I found that QR codes are for text but a file is a set of bytes.

I want to transfer a file from a phone to another phone.

PS: In my app I am using BARCODE API to decode and Zxing to encode

  • What size, what type of file, what do you want to do with it ? You can easily store some file but you need an app to read the content of the QR code and rebuild the file with it. Check [QR CODE max char length](https://stackoverflow.com/questions/12764334/qr-code-max-char-length) to see the maximum capacity of QR code based on the twpe – AxelH Feb 25 '18 at 20:56
  • I want to transfer a file from a phone to another phone, any file type – Beniamin Ionut Dobre Feb 26 '18 at 14:08

5 Answers5

4

I recently created a tool in vanilla javascript called QRFileTransfer , which allows to transfer a file from a computer to another over QR code encoding/decoding, just putting the two device cameras in front of each other ( so all offline )

The principle behind is that I split the file in binary chunks, encode them as qr code, let the receiver decode them and collect the sequence of binary chunks and, at the end, merge them, and that generates the file on the receiver device. Based on the chunk size, the qr code image matrix will be more or less “complex”, and you may check also what’s the max supported size for a qr code as a standard.

Link live test: https://lucaiaco.github.io/QRFileTransfer/ Link source: https://github.com/LucaIaco/QRFileTransfer

Dependencies:

Luca Iaco
  • 3,387
  • 1
  • 19
  • 20
2

alisinabh/paperify does the job. It converts your data to a qr code you can print onto paper. In order to use it, you need to install qrencode, imagemagick and zbar. Here's the source code for creating a qr code: https://github.com/alisinabh/paperify/blob/master/paperify.sh

Pixelcode
  • 357
  • 3
  • 15
1

To include the file content in the QR code, keep in mind there is only a limited amount of data that it can hold.

Here there is more information on the capacity of information you can code in the QR. Information Capacity and version of the QR code

Regarding the binary data you can encode it as a Base64 String. Just be ware that the same information will take up more space after the encoding is done.

Juan
  • 5,525
  • 2
  • 15
  • 26
0

They probably have a link behind the QR Code which opens a web page that handles whatever file it is. So there is not really a "file" in the QR-Code.

mxmtsk
  • 4,285
  • 6
  • 22
  • 47
0

There are services to do that instantaneously. I use QR Agency (https://www.fileshare.agency/) – very simple and free tool.

user3447503
  • 121
  • 1
  • 1
  • 5