How can I get the correct folder ID when uploading assets from a front-end form/plugin?
if ($upload-&gt;isSuccess()) {
     $fileId = $upload-&gt;getDataItem('fileId');
     $asset = craft()-&gt;assets-&gt;getFileById($fileId);
     $folderId = $asset-&gt;getFolder()-&gt;getAttribute('id');
     ...
 }