-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filename not visible (field type: file) #118
Comments
This is not a bug. The "file:" comes from the upload input field and is a label. I did't check what is going on there. If i upload a file, like a pdf file or sth. For which reason do i need a thumbnail? You are right, you need a info what was uploaded. But the upload works. |
Thank you for your reply. Yeah, the thumbnail may not be necessary, but I believe the filename is. I'm using this for a project right now, and my customer won't be able to see which file is which when uploading duplicated files. I guess I'll have to add some custom code myself for this. Is there an easy way to append the filename beside the file label? Or could you point me to which file I could try adding my custom code to? Thanks. |
ok, you wanna get the result fast? |
a little patch? |
go to: plugins/magic-fields-2/field_types/file_field/file_field.php insert an new line after line 45: $out .= $field['input_value']; Not very nice, but helpful. Better is here(line 58): $out .= $field['input_value']; $out .= ''; return $out; |
Gonna try it out, give me a sec! |
I cannot seem to get the value out of $field['input_value'] |
ok, uploaded sth? updated the post? |
yea I tried your code and uploaded a file, made a var_dump on the $field array as well. array(16) { ["id"]=> string(1) "8" ["name"]=> string(21) "yttrandee" ["label"]=> string(25) "Uppladdning" ["description"]=> string(21) "Uppladdning av filer." ["post_type"]=> string(6) "remiss" ["custom_group_id"]=> string(1) "5" ["type"]=> string(4) "file" ["required_field"]=> string(1) "0" ["display_order"]=> string(1) "1" ["duplicated"]=> string(1) "0" ["active"]=> string(1) "1" ["options"]=> array(0) { } ["input_name"]=> string(40) "magicfields[yttrandee][1][1]" ["input_id"]=> string(25) "ryttrandee_1_1" ["input_value"]=> string(0) "" ["input_validate"]=> string(0) "" } |
ok. if i upload a file, i dont see the value. but if i push the"update" button from the post and save the whole post. I get the result. By the way, is a fast and dirty snippet ;) |
Ah! Sorry! I didn't thought you meant update the post =P That works! I know this is a dirty hack, but it will help my customers to see their files. Thank you for your time kobobo. I appreciate your help. If I have time I'll do a javascript solution as well. I see I can get the filename from the data object ^^. Thank you once again! |
i try to write the js code, for showing in ajax without saving action... |
i send you over if it works... lets work this filed_type file_field out together ;) I need it soon. |
Great! Post it here if you manage to do that :) Good work. |
I am working atm and got some stuff to do. I'll look into it if I got some time soon or I'll take a look at it after work :D |
@kobobo, you don't have to write a new AJAX function for this, you can expand file_fields.js to display the filename after a successful upload, eg.: function mf_file_callback_upload(data){
if(data.error == false){
// [...]
// there's already code displaying things for a successful transfer,
// we can expand these with something like this (lazy example):
jQuery('#photo_edit_link_'+data.field_id).append('<br>'+data.file_url);
// [...] And this will display the filename right after a successful transmission. (It needs to be more pretty, it's just an example.) |
So I have both the JS fix and the PHP fix. And here's the file_field.php: I am using the data.name value instead of the whole filepath (data.file_url) on the js solution above. |
Hello!
I have tried the lastest version and the / or the Development version of MF2 on a default theme on wordpress 3.3.1 and the problem is when I upload a file, the filename is not showing up beside the thumbnail right after the text 'file:'. Is this a known issue? Is there a temporary fix for this?
Thanks
/ Panos
The text was updated successfully, but these errors were encountered: