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.
Best solution to attach images to a record
Best solution to attach images to a record
Hello
I am doing a simple dental database application, but I need some images (x-rays)attached to the database for each patient.
What would be the best way to store that - I need the file to be uploaded form the patients form, and be shown when needed. What would be the best solution to do this?
I am doing a simple dental database application, but I need some images (x-rays)attached to the database for each patient.
What would be the best way to store that - I need the file to be uploaded form the patients form, and be shown when needed. What would be the best solution to do this?
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Best solution to attach images to a record
Hi,
If several files per patient have to be stored, a Subform (Type Grid) with an "Upload File" object might be suitable.
https://wiki.nubuilder.cloud/ ... .php/Files
If several files per patient have to be stored, a Subform (Type Grid) with an "Upload File" object might be suitable.
https://wiki.nubuilder.cloud/ ... .php/Files
Re: Best solution to attach images to a record
Hey, thank you
Since I need to store the x rays in as good quality as possible, 300 kb doesnt cut it. What I am working on is a simple html element added to the xray form
jquery, triggered by the save button:
Upon clicking save, nuBuilder will save the file on the server, and create entry in the nuBuilder database, that stores the name of the file, and the customer it belongs to.
I plan add some simple query, that will open the xray in broweser window upon clicking the subform entry of the name
A few things still need to be ironed out.
any suggestions welcome
Since I need to store the x rays in as good quality as possible, 300 kb doesnt cut it. What I am working on is a simple html element added to the xray form
Code: Select all
<form id="data" method="post" enctype="multipart/form-data">
<!--<input type="text" name="first" value="Bob" />-->
<!--<input type="text" name="middle" value="James" />-->
<input type="hidden" name="last" value="" id="xRayName" />
<input name="image" type="file" />
</form>
Code: Select all
$( "#nuSaveButton" ).click(function() {
// e.preventDefault();
var xRayName = $("#pro_name").val();
$("#xRayName").val(xRayName);
console.log(xRayName);
var formData = new FormData(data);
console.log(formData)
$.ajax({
url:"upload.php",
type: 'POST',
data: formData,
success: function (data) {
console.log(data)
},
cache: false,
contentType: false,
processData: false
});
});
I plan add some simple query, that will open the xray in broweser window upon clicking the subform entry of the name
A few things still need to be ironed out.
any suggestions welcome
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Best solution to attach images to a record
Hi,
This form thread might also be useful. It's about uploading files to the server & downloading them.
This form thread might also be useful. It's about uploading files to the server & downloading them.
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Best solution to attach images to a record
I wouldn't do it in this way (will not be triggered if the save shortcut is pressed)deckoff wrote: any suggestions welcome
Code: Select all
$( "#nuSaveButton" ).click(function() {
...
});
Code: Select all
function nuBeforeSave() {
if (nuFORM.edited === true) {
Run your Code here....
}
return true;
}
Re: Best solution to attach images to a record
Hmmm, I also have the problem that values added with
where pro_code is and input id, value get deleted, and the filed is empty. If I add it manually, it stays.
Could that help?
Code: Select all
$( "#pro_code" ).val("test")
Could that help?
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Best solution to attach images to a record
Hi,
You need to invoke .change() otherwise the value will not be saved to the DB.
You need to invoke .change() otherwise the value will not be saved to the DB.
Code: Select all
( "#pro_code" ).val("test").change();