Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

attaching files

Questions related to using nuBuilder Forte.
dmier
Posts: 16
Joined: Thu Apr 11, 2019 8:54 pm

attaching files

Unread post by dmier »

Im having some troubles attaching files to a existing form, I have attached both images, one from the object form and phpadmin,

The problem is that when I save the file, the field goes blank, I already check phpadmin and its saved, what I want is display the image or at least a link to see the file
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: attaching files

Unread post by kev1n »

Check out the JavaScript code of the "Stored Files" form.
dmier
Posts: 16
Joined: Thu Apr 11, 2019 8:54 pm

Re: attaching files

Unread post by dmier »

Code: Select all

function nuShowFile(){
    
    var j   = $('#sfi_json').val();
    
    nuEmbedObject(j, 'view_image');
    	
}
this one?

what about the input image? can it be done with that one? I can click on on it but It will not work

Or a Link to the attached file
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: attaching files

Unread post by kev1n »

This is the relevant code of the "Stored Files" form:

Code: Select all

if(nuFormType() == 'edit'){
    nuShowFile();
}


function nuBeforeSave(){

    var f   = $('#sfi_json_file').val();
    
    if(f != ''){
        
        $('#sfi_json')
        .val(f)
        .change();
        
    }
    
    return true;

}

function nuShowFile(){
    
    var j   = $('#sfi_json').val();
    	debugger;
	if(j == ''){return;}
	
	var ob	= JSON.parse(j)
	var ty	= ob.type;
	var ur	= atob(ob.file);
    var x   = document.createElement("EMBED");
    
    x.setAttribute("type", ty);
    x.setAttribute("src", ur);
//    x.setAttribute("width", "300px");
//    x.setAttribute("height", "300px");

    $('#view_image').html('');
    document.getElementById('view_image').appendChild(x);
        
}

You need two objects:

1. Object to upload a file:
Type Input, Input Type File
ID: sfi_json_file

2. Object to display the image:
Type HTML
ID: view_image

with HTML:
<img
id="theview"
style="border:grey 1px solid;"
>
dmier
Posts: 16
Joined: Thu Apr 11, 2019 8:54 pm

Re: attaching files

Unread post by dmier »

I'm kind of lost, still not showing the image, I have attached pics, where is the JavaScript supposed to be located?
You do not have the required permissions to view the files attached to this post.
dmier
Posts: 16
Joined: Thu Apr 11, 2019 8:54 pm

Re: attaching files

Unread post by dmier »

there is an extra object in the file upload form, im really lost, need help.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: attaching files

Unread post by kev1n »

Is the image displayed after saving?
dmier
Posts: 16
Joined: Thu Apr 11, 2019 8:54 pm

Re: attaching files

Unread post by dmier »

No, its not displaying the image
You do not have the required permissions to view the files attached to this post.
dmier
Posts: 16
Joined: Thu Apr 11, 2019 8:54 pm

Re: attaching files

Unread post by dmier »

I would be so happy, even if its just a display link.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: attaching files

Unread post by kev1n »

Just a moment, please. I'll see if this works for me....
Post Reply