EasyUI Forum
May 14, 2024, 12:21:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Use filebox in crud  (Read 4040 times)
Steve2106
Newbie
*
Posts: 20


View Profile Email
« on: November 04, 2019, 03:17:58 AM »

Hi There,

I am using the crud demo as a starting point.
I am collecting and saving a few fields like Name, Business etc and that is working well.
I now want to put on the form a filebox which will upload a file. My issue is how do I automatically save the user info and upload the file all in one save button.

Thanks for the help.

Best Regards,

Steve.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 04, 2019, 08:02:56 PM »

Please refer the the code below.
Code:
<form id="ff" action="..." enctype="multipart/form-data" method="post">
<input class="easyui-filebox" name="file"...>
</form>
Logged
Steve2106
Newbie
*
Posts: 20


View Profile Email
« Reply #2 on: November 05, 2019, 04:39:28 AM »

Hi StWorthy,

Than you for your reply.

As mentioned I am trying to do this in EasyUI crud example. When I save the file details I would like to also save some details to the user file. I.E. filename, filetype etc. I do not know how to accomplish this.

I have been able to upload a file but do not know how to use an sql statement to save details to database from within the file upload code.

I really appreciate your help.

Best Regards,

Steve.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: November 05, 2019, 08:07:06 PM »

Listen to the 'onChange' event and then call the 'files' method, you can retrieve all the information about the files you selected including name, size, type, etc. Please look at the code below.
Code:
<input class="easyui-filebox" data-options="
onChange: function(value){
var files = $(this).filebox('files');
console.log(files)
}
">
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!