Page 1 of 1

upload file

Posted: Wed May 30, 2018 12:15 pm
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...

Re: upload file

Posted: Wed May 30, 2018 12:51 pm
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

Re: upload file

Posted: Wed May 30, 2018 1:05 pm
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:

Re: upload file

Posted: Wed May 30, 2018 2:14 pm
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.

Re: upload file

Posted: Sat Jun 02, 2018 4:50 am
by admin
.

Re: upload file

Posted: Sat Jun 02, 2018 11:51 am
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 :|

Re: upload file

Posted: Sat Jun 02, 2018 12:18 pm
by toms

Re: upload file

Posted: Sun Jun 03, 2018 7:32 am
by admin
.