I've found information on how to upload an asset as part of creating an entry. What I am trying to do is upload an asset from the frontend without creating an entry. I have a logged in user, and what I would like them to be able to do is upload an asset to a folder that is unique to that user (folder name = username). Help?

1 Answer 1


That's not going to be possible to do without a plugin.

The plugin would need to provide its own Controller which does the following:

  1. Grab info about the uploaded file using UploadedFile::getInstanceByName()
  2. Determine the ID of the asset folder you want to upload the file to using AssetsService::findFolder()
  3. Move the file into the folder using AssetsService::insertFileByLocalPath()

Here’s an example:

// Get info about the uploaded file
$file = UploadedFile::getInstanceByName('fileInputName');
$tempFilePath = $file->getTempName();

// Find the target folder
$folder = craft()->assets->findFolder(array(
    'sourceId' => 1,
    'path'     => 'subfolder/path/'

// Turn the file into a managed asset within that folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.