npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ember-profile-upload

v1.3.0

Published

A simple photo upload component.

Readme

Ember Profile Upload

Build Status

npm version Ember Observer Score This README outlines the details of collaborating on this Ember addon.

This addon provides simple file uploads for photo for things like profile pics.

Installation

ember install ember-profile-upload

Setup

To Allow for flexibility for server uploads, you will need to add a profile-upload service to your application:

ember g service profile-upload

Uploads with Cloudinary

For easy use, this addon comes with a fully implemented profile-upload service that allows you to upload images to Cloudinary. Before being able to use this service, you will need to install ember-get-config and ember-network:

ember install ember-get-config ember-network

Next add a basic set of config to your config/environment.js to configure Cloudinary:

cloudinary: {
  cloudName: `my-cloud-name`,
  uploadPreset: `emberez`,
},

Where cloudName is your account's cloud name, and uploadPreset is the name of an unsigned upload profile which can be configured in your upload settings.

Finally, in your generated profile-upload service, add the following:

import CloudinaryProfileUpload from 'ember-profile-upload/services/cloudinary-profile-upload';

export default CloudinaryProfileUpload.extend();

Now, you're all setup to use the profile-upload component.

Component Use

Now that things are setup, you are ready to use the profile-upload component. The component takes three attributes:

  • fileUrl - The current profile photo url
  • placeholderUrl - The image url to show if no photo is currently shown
  • onchange - A function to run when the file has successfully uploaded. This will be run with the result from your service's deserializeResponse

A quick example could be:

{{profile-upload
  fileUrl=url
  placeholderUrl="profile.jpg"
  onchange=(action (mut url))}}

Custom service

To support uploading files, you will need to implement two functions in this service:

  • upload - Returns a promise to upload the file to your API
    • Receives a file argument which is the first file's File object from a file input
  • deserializeResponse - Returns a string URL of the uploaded file from payload returned by upload

Optional Setup

The profile-upload service can also contain two other methods for greater flexibility:

  • destroyImage - Instructs the API to delete the old file
  • requestError - Handle errors from the AJAX request

Example service

The service below shows how to integrate with a Loopback API using loopback-component-storage as shown in the loopback-example-storage:

import Ember from 'ember';
import config from '../config/environment';

export default Ember.Service.extend({
  upload(file) {
    const data = new FormData();
    data.append(`value`, file);

    return Ember.$.ajax({
      data,
      method: `POST`,
      cache: false,
      processData: false,
      contentType: false,
      url: `${config.apiHost}/api/containers/${config.containerName}/upload`,
    });
  },

  destroyImage(file) {
    const url = file.replace(`download`, `files`);

    return Ember.$.ajax({
      method: `DELETE`,
      url,
    });
  },

  deserializeResponse(response) {
    const data = response.result.files.value[0];

    return `${config.apiHost}/api/containers/${data.container}/download/${data.name}`;
  },

  requestError(err) {
    // Handle request errors here
    console.log(err);
  },
});

License

This software is distributed under the MIT license.