cancel
Showing results for 
Search instead for 
Did you mean: 

Problem FileUpload the same file.

Former Member
0 Kudos

I'm uploading excel files, it works when i upload "file1.xls" and then "file2.xls", but when i try to upload the same file 2 times, it's where it goes wrong. Because the "FileUpload component" does not get clean.

Example:

I have a FileUpload component, when i upload "file1.xls" the component resource value is set to 'null', wich is right, but if upload the same file once again, the resource value is set to 'null' but the input is not cleaned, it still showing the file path, wich should be 'null'.

I mean if upload "file1.xls", "file2.xls", "file1.xls", "file2.xls"..etc. It works.

If upload "file1.xls","file1.xls"...etc. It fails.

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

what's the error message?

Former Member
0 Kudos

There is not error message, the problem is that the input of the path does not gets cleaned, for example if you select a file from "C:\file.xls" in the input you'll see "C:\file.xls", once it has been uploaded, you'll see in the input " ", but if you try to upload the same file once again you will have in the input "C:\file.xls", once the file has been uploaded (for second time) the input is 'C:\file.xls', it does not gets cleaned at the second time.

Thanks for your answer.

Former Member
0 Kudos

Hi jorgekbw3,

set the context value with your IResource to null after the upload.

If you select a file again, the resource is filled again with the new file.

Hope this works.

regards

Gunter

Former Member
0 Kudos

I did, and that's the problem, when i upload different files, it works, but when it's the same file, does not work, rather, functions halfway, the attribute value is set to null, but for some reason, the input, continues showing the path. And if i try to upload the file for the third time, it says the path is null.

hope i explained myself, thanks for your answers.

Former Member
0 Kudos

Your problem most likely lies in your code.

Please post all relevant code.

Former Member
0 Kudos

public void onActionLoadExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionLoadExcel(ServerEvent)

IUploadElement uploadElement = wdContext

.currentUploadElement();

IWDResource excelPath = uploadElement.getExcelPath();

if (excelPath != null) {

//Method for upload file

wdThis.wdGetUploadController().loadXls();

// Clean the path

uploadElement.setExcelPath(null);

} else {

mesageManager.reportWarning("It's null");

}

//@@end

}

// the excelPath is the resource attribute

Thanks.

Former Member
0 Kudos

Please also post the code for

wdThis.wdGetUploadController().loadXls(); 

And please use the code tags to format the code in a readable manner.