Is there documentation somewhere about how to get this to work in an SAEF? I can’t get it working. The files upload fine, but if you go “edit” in the CP, the files don’t show up. They’re physically on the server, in the right folder, and renamed if they had a duplicate name, but the custom field is empty.
OK, according to ngen, this is a known issue for v1.0. So then, how the hell do I get v0.9.10??? All you can download is 1.0, but it doesn’t work with an SAEF. Am I the only one that finds this kind of strange? They broke a key component of the extension, then called it “1.0?”
I’m not sure how many of you would want this, but I basically had to customize this extension for my needs. I was originally trying to get some help from nGen, but they didn’t seem too interested in even talking to me and just told me to subit a feature request. Needless to say, when you need something NOW, you don’t submit feature requests, you go make features yourself.
So, what I have working now is nGen file field creating unique sub-folders for each author. So, if your author ID is say 123, instead of files being uploaded to images/uploads/, they get uploaded to images/uploads/123/. This was critically important as the site I’m doing this for will have tens of thousands of “authors” (users) that each need to upload about 10 images. Having all of the images all in one folder would be a bad idea, obviously, so I came up with this. Now I just need to modify what I have a touch so instead of /123, it gets exploded and put together as /1/2/3. With 10,000 users, having 10,000 folders in one place would almost be as bad as all of the images in one folder, so I think doing the sub folders for each digit will be the best way around that.
Anyway, if this is something you’re interested in, let me know and I’ll post the code. I have it working with an SAEF and the CP.
Now, there were some other minor issues, such as getting nGen to create new folders on publish, not just edit, and I fixed those as well. For whatever reason, if a folder doesn’t exist when using the Edit CP, nGen makes a new folder you, but this function never gets executed from the publish CP. Now I have that working on both.
I have the “exploded” version working now, where it makes sub-folders 6 digits deep. So for example, a user ID of 123456 would have images located at: images/uploads/1/2/3/4/5/6/filename.jpg. User ID 1 would be located at: images/uploads/0/0/0/0/0/1/filename.jpg.
This is the code:
// // Retrieves the upload preferences for an upload location // returns upload_prefs array // function _get_upload_prefs($u_id) {
$query = $DB->query("SELECT * FROM " . $this->db_prefix . "_upload_prefs WHERE id = $u_id");
if (isset($_POST['author_id'])) { // if this is a new entry, get the author id from the hidden form field $author_id = $_POST['author_id']; } else if (isset($_GET['entry_id'])) { // if this is an existing entry, get the entry ID and find the author $entry_id = $_GET['entry_id']; $author_query = $DB->query("SELECT * FROM " . $this->db_prefix . "_weblog_titles WHERE entry_id = $entry_id"); $author_id = $author_query->row['author_id']; } else { // if all else fails, give it a 0 value so there aren't any "undefined" notices $author_id = "0"; }
$auth = $author_id . ""; // get the author id and convert it to a string $length = strlen($auth); // get the number of digits of the id
Fatal error: Out of memory (allocated 63700992) (tried to allocate 26608 bytes) in /home/ZZZ/public_html/manage/extensions/fieldtypes/ngen_file_field/ft.ngen_file_field.php on line 842
but the file does not appear in FTP to delete, and increasing the max upload size did not help. What do I do to get rid of this error so I can make changes to my entries again?
yeah I already did increase memory limit in php.ini. Didn’t solve problem (and actually, the file upload that broke it was not over the limit). Also, I upgraded the plugin, and now no error displays, but any of the weblogs that use that field group display a white page if you attempt to edit them.
I’d like to use nGen and FF for an existing EE1 website, and i’m currently using the old File extension. Is there any documentation or guidance that people could point me to for migrating from File to nGen easily? I’ve got about 2,000 entries so really don’t want to do this manually!