cancel
Showing results for 
Search instead for 
Did you mean: 

sap.ui.commons.FileUploader

Former Member
0 Kudos

Hi

I am trying to upload a file but

after I press 'browse' and select

the file to upload, I do not see the

file name in my text input field.

I searched and saw that it is advised to use

sap.ui.unified.FileUpload , but although the

package sap.ui.unified is there, this class cannot

be found in this package.

I will be grateful for any suggestion.

regards

Yuval

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

HI YUVAL

Here is an example file name is shown correct.

BTW, which version of SAPUI5 are you using.

As Jason has pointed out, sap.ui.commons.FileUploader has been depreciated.

Thanks

-D

Former Member
0 Kudos

Hi

Thank you very much for pointing me to this blog.

I have used the following


<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.ui.commons"

            controllerName="views.main" xmlns:html="http://www.w3.org/1999/xhtml">

         

         

            <FileUploader xmlns="sap.ui.commons">    </FileUploader>

</core:View>

And it works nicely!

But I have also looked at the referenced sap_ui_core.js

https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js

and could not find the new unified.FileUploader class.

Regards

Yuval

jmoors
Active Contributor
0 Kudos

Looking at your code you are still using the sap.ui.commons.FileUploader, i.e. you are using the "sap.ui.commons" namespace for the FileUploader control. If you changed the xmlns to use "sap.ui.unified' name space it would use the correct control.

The FileUpload is not part of the core library, the correct path for the unified FileUploader would be:

https://sapui5.netweaver.ondemand.com/resources/sap/ui/unified/FileUploader.js

Also make sure you update the bootstrap to include the unified library.

<script id='sap-ui-bootstrap' type='text/javascript'

        src='https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js'

        data-sap-ui-theme='sap_goldreflection'

        data-sap-ui-libs='sap.ui.commons,sap.ui.unified'>


Regards,

Jason

Former Member
0 Kudos

Hi Jason

Thank you very much for referring to the right location

and enlightening me .

I just re-checked  and found that that this file is not included

in the core packge imported to EClipse.

I will try to add it to eclipse now.


Thank yuo very much.

rewgagand import it

regards

Yuval

jmoors
Active Contributor
0 Kudos

Hi Yuval,

If you check you eclipse plugin directory you should find the com.sap.ui5.unified_x.xx.x.jar file

Many thanks,

Jason

Former Member
0 Kudos

Hi Jason

I checked the jar version and it is com.sap.ui5.unified_1.20.7.jar.

Anyway 'FileUploader' is not part of this js file contained therein.

I managed however to download the javascript file

from the link you provided to  then include

it in my  project 'Libraries'. I also followed your good advice and

referenced this file in index.html :

<script id='sap-ui-bootstrap' type='text/javascript'

        src='resources/sap.ui.unified.js'

        data-sap-ui-theme='sap_goldreflection'

        data-sap-ui-libs='sap.ui.commons,sap.ui.unified'>

However when I try to include FileUpload in my xx.view.xml

I cannot locate this file.

What have I done wrong.?

I really appreciate your assistance here.

Regards

Yuval

jmoors
Active Contributor
0 Kudos

Hi Yuval,

You shouldn't need to copy any files, how are you runnng the applications via Eclipse? The .js files should be under the META-INF/resources directory in the jar file,

Looking at your bootstrap, you hav changed the src path, this should still point to the sap-ui-core.js, the unified lib should only be added to the data-sap-ui-libs.

<script id='sap-ui-bootstrap' type='text/javascript'

        src='resources/sap-ui-core.js'

        data-sap-ui-theme='sap_goldreflection'

        data-sap-ui-libs='sap.ui.commons,sap.ui.unified'>

When you say you can't locate the file do you mean in the browser debugger? If you look in the network tab, do you see the files are requested?

It might be worth looking at the FileUploader test page.

https://sapui5.hana.ondemand.com/sdk/#test-resources/sap/ui/unified/FileUploader.html

Many thanks,

Jason


Answers (1)

Answers (1)

jmoors
Active Contributor
0 Kudos

Hi Yuval,

Not sure if it's a typo, however the correct control name is sap.ui.unified.FileUploader

What version are you using? The sap.ui.commons.FileUploader has been deprecated since 1.21.0.

Regards,

Jason