# Blocking problem : Upload \*.jpg file fails

**URL:** <https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [July 29, 2021, 12:02pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063 "2021-07-29T12:02:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hajer.sassi](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hajer.sassi/32/16104_2.png) [@hajer.sassi](https://forum.katalon.com/u/hajer.sassi)\
**Post date:** [July 29, 2021, 12:02pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/1 "2021-07-29T12:02:48Z")

</div>

Hello,

I am using Katalon 8.0.5 and trying to upload jpg file via the following command line:  
WebUI.uploadFile(findTestObject(‘Object Repository/SpyElements/2\_Critères\_de\_recherche/9\_Upload\_ID/div\_Recto’), ‘C:\Users\username\Desktop\ID\recto.jpg’)

And I got the attached error:

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/c/0/c04bcd7fbade7c1edb89ff6c19cee709cd403841.png)

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/c/0/c04bcd7fbade7c1edb89ff6c19cee709cd403841.png)

Could someone help me to solve this problem?  
Should I make some prior configurations before using this command line?

Thank you in advance for your help 🙂

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [July 29, 2021, 2:47pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/2 "2021-07-29T14:47:02Z")

</div>

Please give this solution a try:

> [@How to Resolve File Upload Issues](http://forum.katalon.com/t/how-to-resolve-file-upload-issues/29812):
>
> I’ve been seeing several topics around issues with uploading files to a web application when using the WebUI.uploadFile() method, so I thought I’d share the best alternative approach (note: this is the same approach that one would take in Selenium as well): Step 1: Identify the file upload field Lets take a typical file upload field: [image] What we want is the \<input\> element for the field, which will look something like this (with probably a bunch of other attributes): \<input type="file" …

---

<div class="post-metadata">

**Author:** ![hajer.sassi](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hajer.sassi/32/16104_2.png) [@hajer.sassi](https://forum.katalon.com/u/hajer.sassi)\
**Post date:** [August 3, 2021, 2:24pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/3 "2021-08-03T14:24:25Z")

</div>

Thank you very much for your answe @brandon.hein It’s seemes to be ok (i don’t have the previous error) but now I have another error, Katalon is enable to locate the object:

_Unable to find the element located by ‘By.xpath: //input[@id=’/html[@class=‘ks-webkit537 ks-webkit ks-chrome92 ks-chrome’]/body/div[@id=‘root’]/form/div[@class=‘App’]/div[@class=‘Content’]/div[@class=‘sc-kHlotv hgKpxV IdentityDocumentScreen’]/div[@class=‘sc-bybRYC eHREYu’]/div[@class=‘sc-iihChq iPmKbR’][1]/label[@class=‘sc-cqktmv hHoqOB’]’]’. Please recheck the objects properties to make sure the desired element is located._

I also tried using Object Spy but I got the same error.

Do you please have an idea about how resolving this problem?

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [August 3, 2021, 3:14pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/4 "2021-08-03T15:14:57Z")

</div>

I would need to see the HTML for the field you are trying to locate to give you a solution.

---

<div class="post-metadata">

**Author:** ![hajer.sassi](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hajer.sassi/32/16104_2.png) [@hajer.sassi](https://forum.katalon.com/u/hajer.sassi)\
**Post date:** [August 3, 2021, 3:22pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/5 "2021-08-03T15:22:09Z")

</div>

Thank you for your reactivity 🙂 Please find it below and attached the info concerning my object:

String path1 = “C:\Users\myUserName\Desktop\ID\recto.jpg”

WebUI.sendKeys(findTestObject(‘Object Repository/SpyElements/2\_Critères\_de\_recherche/9\_Upload\_ID/input\_ID\_Recto’), path1)

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/0/6/06dcdd6c092f49805927c75ecfd61c80618298f3.png)  
 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/0/0/00ef6ff9586554d345353af067ad6ae126da5246.png)

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [August 3, 2021, 3:25pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/6 "2021-08-03T15:25:36Z")

</div>

The xpath in your test object should be:

`//input[@data-testid='nationalIdentityCardRecto#FileInput']`

notice that we are targeting the **@data-testid** attribute, and not the **@id** attribute as you have in your current xpath.

---

<div class="post-metadata">

**Author:** ![hajer.sassi](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hajer.sassi/32/16104_2.png) [@hajer.sassi](https://forum.katalon.com/u/hajer.sassi)\
**Post date:** [August 3, 2021, 3:28pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/7 "2021-08-03T15:28:51Z")

</div>

Yeeeess!! Thank you very much!! It’s finally working 😃 💪

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [August 3, 2021, 3:29pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/8 "2021-08-03T15:29:18Z")

</div>

Great 🙂 Please consider marking an answer to this topic for others to reference.

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [August 3, 2021, 3:36pm UTC](https://forum.katalon.com/t/blocking-problem-upload-jpg-file-fails/57063/9 "2021-08-03T15:36:13Z")

</div>

I have marked the appropriate solution to this post. Cheers 🙂
