EasyUI Forum
September 14, 2025, 03:36:00 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to get the files array (not the file name) from filebox component?  (Read 13635 times)
dacracot
Newbie
*
Posts: 6


View Profile
« on: July 23, 2015, 08:10:35 AM »

With the HTML, <input id="HTML-GetFile" type="file"/>, I can get the get the files array via $('#HTML-GetFile').files; for each file with its name, size, etc.

But for the EasyUI component, <input id="EasyUI-GetFile" class="easyui-filebox"/> there is no files property.

This call, $('#Upload-ChooseFile').filebox('getValue'); yields only the file name.  Buried in the generated code is the array I need assessable via $('firebox_file_id_1')[0].files;, but I had to dig through the DOM to find this and I have to believe this ID, being code generated, is brittle.

What must I do to get the files array rather than just the file name directly from my filebox component?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: July 23, 2015, 08:27:41 AM »

Please try the code below to get the file input element and retrieve the files array.
Code:
var f = $('#EasyUI-GetFile').next().find('.textbox-value');
console.log(f[0].files);
Logged
dacracot
Newbie
*
Posts: 6


View Profile
« Reply #2 on: July 23, 2015, 08:43:15 AM »

That worked, but is this compound statement any less brittle if I upgrade the libraries at some point in the future?
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!