I am using File to add multiple PDFs in a custom field, however, I can only get the first file uploaded to show. Am I doing something wrong here?
{if soft_file}<a href="http://{soft_file}">{soft_file}</a>
{/if}
@slorenz
{soft_file} is a single tag - you need a tag pair.
{if soft_file}{soft_file}<a href="http://{file_url}">{file_url}</a>
{/soft_file}{/if}
Edit: sorry, amended code - missed the href!
2nd Edit: From the docs…
Single Variables
* {[custom_field]} — When used alone, the custom field will output the first uploaded image
Variable Pairs
* {[custom_field]}…{/[custom_field]} — When used as a pair the contained code will loop, outputting all the uploaded files.
o count — Numeric number of each file
o total_results — Total number of files uploaded to the custom field
o file_name — Filename of the uploaded file.
o file_url — URL to the uploaded file.
o file_thumb_name — Filename of the uploaded thumbnail.
o file_thumb_url — URL to the uploaded thumbnail.
I’m using file in a multi site. It’s an international site, so basically the other sites are copies of each other, with the language changed. I’m having some problems with file in that context. The first site works fine, but all the derivative sites (the sites that were copied from the first one), the files uploaded with file are not showing properly.
Example:
{if image_small}{image_small}{file_thumb_url}{/image_small}{if:else}{skin_url}images/ss_placeholder_small.gif{/if}
It actually passes the first case as true, but then doesn’t show anything inside of the tag pair.
Hey I fixed my own problem. The problem is the file is not really MSM ready. Here’s what I did:
Find this statement around line 1127 in 3.1.1
$SESS->cache['mh_file_ext_fields'] = $DB->query('SELECT * FROM exp_weblog_fields f, exp_upload_prefs p WHERE f.field_type="file" AND p.id=f.field_list_items');
Replace it with this:
// Is MSM enabled?
$msm = ($PREFS->ini('multiple_sites_enabled') == 'y') ? TRUE : FALSE;
// Get the current Site ID
$site_id = $PREFS->ini('site_id');
$SESS->cache['mh_file_ext_fields'] = $DB->query('SELECT * FROM exp_weblog_fields f, exp_upload_prefs p WHERE f.field_type="file" AND p.id=f.field_list_items' . ($msm ? " AND f.site_id = {$site_id}" : ""));
You’ll also need to add $PREFS to the global delcaration on line 1116
global $DB, $FNS, $TMPL, $EXT, $SESS, $PREFS;
Hi, I installed extension, but when I upload image that is smaller than specified max sizes it makes thumb with width and height specified.
example: original file is: 134x200px thumb is:670x1000px;
I set resize option to “Auto”. Maximum Image Height (in pixels): 1000px Max height:700px
Is there a chance that uploaded photo remain not resized if it is smaller than specified max width and height?
Hi, I installed extension, but when I upload image that is smaller than specified max sizes it makes thumb with width and height specified. example: original file is: 134x200px thumb is:670x1000px; I set resize option to “Auto”. Maximum Image Height (in pixels): 1000px Max height:700px Is there a chance that uploaded photo remain not resized if it is smaller than specified max width and height?
I posted this fix earlier.
In ext.mh_file_ext.php, right after the code
// =============================================
// Calculate Width/Height
// =============================================
$dst_x = 0;
$dst_y = 0;
$dst_width = ($file_field['max_width']!='')?$file_field['max_width']:$dimensions[0];
$dst_height = ($file_field['max_height']!='')?$file_field['max_height']:$dimensions[1];
insert
if($dst_width > $src_width) {
$dst_width = $src_width;
}
if($dst_height > $src_height) {
$$dst_height = $src_height;
}
It will check to see if the original image is smaller than the max width or height. It will still create a thumbnail file with the same dimensions as the original image.
@eyevariety: Saying it’s “seriously outdated” is an exageration - File still has some key features that aren’t available yet in nGen File Field - such as automatic resize on upload to prevent huge files from being uploaded and stored on the server.
I’ve converted 2 sites over to nGen File Field, only to convert them back again when client’s do stupid things.
There’s still life in it yet, although it would be good if Mark had time for an update 😊
I guess “outdated” is going too far- but being able to easily choose already uploaded files, and the renaming are light years ahead of Mark’s extension as far as user experience. I prevent my users from uploading huge files using the file upload folder’s settings. GD resize is decent but relying on it to resize an image multiple times - once at upload and then again at render for img sizer- sounds like unnecessary compression and jpg artifacting.
What both need is a visual file browser and a method for storing what articles an image has been used in. - IE wordpress’s media library. When we get there - things will really be accelerating for the end user experience.
Multi upload and image preview thumbnails stopped working.
Read through many of the pages of this thread and searched the forums but haven’t seen this yet. I upgraded to EE 1.6.7 (from 1.6.4) and Mark Huot’s File extension is no longer working. I’ve tried disabling all extensions except File, to no avail.
Currently I’m still able to upload an image, but I can’t upload more than one and the thumbnail previews have disappeared and are now replaced with a generic image icon. I have no idea about the image preview but noticed using Firebug that the upload field is there but set to display:none. Me things a jQuery collision may be happening?
Recently got FieldFrame and nGen File Field working, it’s great.
I’d like to move the whole site to nGen but I have many sections and hundreds and hundreds of files to move. Need to get this working again in the meantime!!
Any ideas?
p.s. PHP 5.5 & memory is 64MB.
My issue is fixed. At some point during an upgrade the settings in Section Administration › File Upload Preferences got reset/wiped so multiple uploads and thumbnails were disabled.
I’m going to leave that post up (sorry for polluting the thread) in case someone else makes the same mistake I did. Doh, so embarrassed.
I was wondering if anyone knows a way to make it so that I can choose multiple files when the Open File dialogue box comes up. The multiple file upload functionality is great, but in my particular case, I’m using file upload for pretty large image galleries with up to 100 pictures each. I was hoping there was a way I could just highlight all images and have them all add to the File field queued for upload…Anyone ever try doing this?
File loop …
Hi Everyone,
I love this extension, and I’m trying to figure out the best way to use the loop. I’ve allowed multiple uploads with the extension, and to display them in a template I’m using the {if [custom_field]}{/if}. They are images, and each one is being floated with css so they line up like a gallery. What I want is for the loop to spit out a bit of html after every third image … to keep things from going haywire on the rendered page.
Basically I want to create a kind of while loop for the multiple files. Could I do it with the Loop Plugin? Do I have to use PHP?
Here’s my code:
{if image}
{image}
{file_url}
{/image}
{/if}
I’d really appreciate any help I can get! I’m kind of new to EE.
Thanks a ton:
Basically I want to create a kind of while loop for the multiple files. Could I do it with the Loop Plugin? Do I have to use PHP?
You do need to use PHP.
Also worth checking out– The nGen File Field extension: http://ellislab.com/forums/viewthread/110252/
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.