---
name: "NJB_Send_File"
section: "3"
platform: "linux"
package: "libnjb1-doc"
version: "1.1-2"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/NJB_Send_File"
---

# NJB\_Send\_File(3)

transfer a datafile to the jukebox

## NAME

NJB\_Send\_File - transfer a datafile to the jukebox

## LIBRARY

libnjb

## SYNOPSIS

\#include \<sys/types.h\> #include \<libnjb.h\>

extern int njb\_error

int NJB\_Send\_File (njb\_t  **\*njb**, const char **\*path**, const char **\*name**, XferCallback **\*callback**, void **\*data**, u\_int32\_t **\*fileid**)

## DESCRIPTION

This function downloads the data file at **path** to the NJB. Data files are not music tracks, but general data storage containers on the jukebox. The  **name** parameter is not required, if it is NULL, the  **path** parameter will be used to name the sent file. Typically the **name** parameter should be sent to set a name which does not contain any path information or delimiters (like :, / etc).

After the file is sucessfully transferred, the  **fileid** variable is updated with the ID that was assigned by the NJB.  This  allows the calling program to update any local file caches.

The  **callback** parameter is a pointed to a callback function, as described in [**NJB\_Get\_File**(3)](/NJB_Get_File/3.md).

The  **data** parameter is a pointer to user data of any kind that the user of the library wants to associate with this transfer. This pointer is used for example when accessing several different jukeboxes from withing one program. The XferCallback will also be delivering this pointer to the target routine for dereferencing. If this parameter is not used (in for example single-device, single-threaded programs) it may be set to **NULL.**

(On NJB1, this function increments the NJB's library counter, provided it has not been incremented previously during the session.)

## RETURN VALUES

If the transfer is successful, NJB\_Send\_File returns 0.  Otherwise, -1 is returned and  **njb\_error** is set.

- EO\_ABORTED

  The transfer was aborted by the user (the callback function returned -1).

- EO\_BADCOUNT

  The library counter on the NJB could not be updated.  The file transfer was successful.

- EO\_BADDATA

  **datafiletag** contains invalid data or is not properly formed.

- EO\_BADSTATUS

  A non-zero status was returned by the NJB during the file transfer.

- EO\_INVALID

  A required parameter was NULL.

- EO\_NOMEM

  There was not enough memory to allocate the file transfer buffer.

- EO\_NOMEM

  There was not enough memory to create the "tag" for the datafile.

- EO\_RDSHORT

  The NJB sent fewer bytes than expected on the bulk data pipe.

- EO\_TIMEOUT

  The NJB did not verify that the transfer was complete after several queries.  The file may have still have been transferred successfully.

- EO\_TOOBIG

  There is not enough free disk space on the NJB to hold the file.

- EO\_USBBLK

  An I/O error occurred on the bulk data pipe.

- EO\_USBCTL

  An I/O error occurred on the control pipe.

- EO\_WRSHORT

  Fewer bytes than requested were written to the USB pipe.

- EO\_XFERDENIED

  Could not determie the available disk space on the NJB.

- EO\_XFERERROR

  The NJB returned a non-zero status when the tag for the datafile was transferred.

## SEE ALSO

[NJB\_Get\_File(3)](/NJB_Get_File/3.md), [datafile(3)](/datafile/3.md), [XferCallback(3)](/XferCallback/3.md)
