Welcome to the nuBuilder Forums!

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

upload file

Questions related to using nuBuilder Forte.
Post Reply
ajay
Posts: 38
Joined: Wed May 16, 2018 1:01 pm

upload file

Unread post by ajay »

Hi,
i want to upload files jpg,pdf etc?
i have created form with a field fileand a button:

1 what code to write on button to upload file?
2 where the file will be saved?
3 can i fix the size for file to upload?

Please help...
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: upload file

Unread post by toms »

1. No coding is required. Just place a Input:File Object on your form.
2. The files are stored in the database
3. The Limit is 300 Kb

The get the size, set a limit, add an event listener. E.g.

Code: Select all

var myFile = document.getElementById('visitors_photo_file');

myFile.addEventListener('change', function() {
  alert('File size ' + this.files[0].size);
  if (size > 100000) { // if the file is bigger than 100KB, clear the input file
     this.value = '';
  }
});

https://wiki.nubuilder.cloud/ ... .php/Files
ajay
Posts: 38
Joined: Wed May 16, 2018 1:01 pm

Re: upload file

Unread post by ajay »

I have entered the code in BS, it is showing alert when file size is greater than given size but there is error when size under the given size...

and how do i access these uploaded files, want to provide a link to open file after it uploaded... :roll:
You do not have the required permissions to view the files attached to this post.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: upload file

Unread post by toms »

This is Javascript, not PHP!

Downloading the files again might be trickier. "Home ► Stored Files" could give you ideas on how to do that.
In any case, your should have a (good) knowledge of javascript.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: upload file

Unread post by admin »

.
ajay
Posts: 38
Joined: Wed May 16, 2018 1:01 pm

Re: upload file

Unread post by ajay »

toms wrote:This is Javascript, not PHP!

Downloading the files again might be trickier. "Home ► Stored Files" could give you ideas on how to do that.
In any case, your should have a (good) knowledge of javascript.
ok, thanks
i will try to find out solution.
There should be an easy way to access uploaded files to make any application meaning full :|
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: upload file

Unread post by toms »

admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: upload file

Unread post by admin »

.
Post Reply