Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
attaching files
-
- Posts: 16
- Joined: Thu Apr 11, 2019 8:54 pm
attaching files
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
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.
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
-
- Posts: 16
- Joined: Thu Apr 11, 2019 8:54 pm
Re: attaching files
Code: Select all
function nuShowFile(){
var j = $('#sfi_json').val();
nuEmbedObject(j, 'view_image');
}
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.
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: attaching files
This is the relevant code of the "Stored Files" form:
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;"
>
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);
}
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;"
>
-
- Posts: 16
- Joined: Thu Apr 11, 2019 8:54 pm
Re: attaching files
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.
-
- Posts: 16
- Joined: Thu Apr 11, 2019 8:54 pm
Re: attaching files
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.
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
-
- Posts: 16
- Joined: Thu Apr 11, 2019 8:54 pm
Re: attaching files
No, its not displaying the image
You do not have the required permissions to view the files attached to this post.
-
- Posts: 16
- Joined: Thu Apr 11, 2019 8:54 pm
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact: