4

I have a simple safecracker form that allows guests to submit entries to my site. It works fine until I include Pixel and Tonic's Assets module, upon which point, when the browser attempts to load the page (even before submission) - I get an error in chrome stating "script on the page used too much memory".

This is essentially all i'm doing:

{exp:safecracker channel="inspirations" return="site/inspiration_submitted"}
    {field:inspiration_image}
{/exp:safecracker}

Anyone able to successfully get Safecracker to work with Assets? I'm using the latest versions of both as of today's date, along with jquery 1.8.3.

2
  • Point of clarification, Assets does more than allow a file to be uploaded, it also assumes you want to browse the current assets. Are you trying to just upload a file or do you want users to browse files? Commented Dec 7, 2012 at 13:29
  • Just want to be able to allow a user to upload a file (I'd actually prefer they don't see the other files), but to the field that uses the assets field type.
    – mheavers
    Commented Dec 7, 2012 at 13:33

1 Answer 1

3

About a year ago @BrandonKelly, Pixel and Tonic mentioned potentially adding support for using just using the SafeCracker File Upload field to upload to Assets, but I'm not certain if that has happened, as of yet.

There are ways to hide the file browser, using CSS or Javascript, but that wouldn't solve your memory issue, since the script to examine the directory is still triggered, it's just that the results are hidden.

I recommend, if users are ONLY uploading a file to a directory from the front end, switch to either SafeCracker File Upload or the EE File Upload. Looking through the documentation, I don't see any new data on configuring the File Upload to NOT display the directory, and that can take a fair amount of memory.

The other option is to, of course, point to a directory with a very small number of resources. For example, create a new file upload area, specifically for the form. Assuming that you won't have 100s of uploads, this shouldn't use as much memory. Of course, if you are expecting 100s or 1000s of uploads, then the same issue will occur, as more applications/forms get completed.

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.