[Skip to main content](#vessel-content)

#   upload fail topic #350311

##

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 2 months ago -  3 years 2 months ago [\#354246](#354246) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354246 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")* was created by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")*

-- HikaShop version -- : 4.7.5
-- Joomla version -- : 4.3.3
-- PHP version -- : 8.1
-- Error-message(debug-mod must be tuned on) -- : upload fails with JCH

Hi,

In the improvements of version 4.7.4 this item was mentioned:

• The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.

But I still have the same upload error (bar turning red) with JCH optimize active?

I made the changes again in the upload.php files to get it working. So you can not test on our website.

Last edit: 3 years 2 months ago by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86283
- Thank you received: 14262
-
-

3 years 2 months ago [\#354250](#354250) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354250 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi,

The code added to HikaShop regarding the improvement you're pointing at doesn't contain any of the changes discussed on this other thread.
We actually talked with a developer of JCHOptimize about the issue, and they proposed another modification so that the javascript of the uploader would get the CSRF token from Joomla before sending the AJAX request. That way, it would be up to date as JCH sets the CSRF token in the javascript so that it is not cached.
So with these modifications, the other modifications in the upload.php files shouldn't be necessary.

Now, with your feedback, I look deeper into it again, and I think I've made a mistake when implementing the changes. I've made a patch which should make it work without modification necessary in the uploader.php files.
Download again the install package of the 4.7.5 and install it on your website to get the patch and it should work without having to change the code in the uploader.php file.
If that still doesn't work, please provide a link to a page with the issue on your website so that we can look into it again (you can add the modifications again in that case, we'll still be able to study the issue).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 2 months ago [\#354268](#354268) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354268 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi Nicolas,

Thanks, I downloaded and installed the update. Unfortunately the issue is still there. So I made the changes again.

This is one page with the issue:

[ jouwnaambord.nl/plexiglas-naambord-met-eigen-foto](https://jouwnaambord.nl/plexiglas-naambord-met-eigen-foto)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86283
- Thank you received: 14262
-
-

3 years 2 months ago [\#354276](#354276) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354276 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi,

I still see the same javascript code on your page, without the modification I added yesterday.
I suppose you forgot to clear your JCHOptimize cache and thus you're still seeing the old code on the page and that's why it still didn't work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 2 months ago [\#354280](#354280) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354280 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi Nicolas,

I thought I deleted this page, but I will look at it asap. There's also an issue with JCH, so I will test tomorow. Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 2 months ago -  3 years 2 months ago [\#354455](#354455) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354455 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi,

After clearing all cache it worked fine. Don't know why, but now the upload error is back again. See screenshot.
f.e. on [ jouwnaambord.nl/bedrijfsnaambord-wit-aluminium-15-x-20-cm](https://jouwnaambord.nl/bedrijfsnaambord-wit-aluminium-15-x-20-cm)

I made the modifications again to the upload.php

- [ ![upload-fails.jpg](/forum/attachment/57637) ](/forum/attachment/57637 "upload-fails.jpg") [ ](/forum/attachment/57637?download=1 "upload-fails.jpg")

Last edit: 3 years 2 months ago by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86283
- Thank you received: 14262
-
-

3 years 2 months ago [\#354456](#354456) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354456 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi,

I just did a test and it worked fine and I can see the token in the upload request:
[ i.imgur.com/HYBhPJr.png](https://i.imgur.com/HYBhPJr.png)
Could the problem be elsewhere ? Like you provided a file which isn't compatible with the restrictions you have in place ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 2 months ago [\#354502](#354502) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354502 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi Nicolas,

No, I got messages from customers that the couldn't upload. So I tested it myself and the upload indeed failed on all permitted file extensions.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86283
- Thank you received: 14262
-
-

3 years 2 months ago [\#354512](#354512) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354512 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi,

Then I don't see why it would fail since now the token is properly provided by HikaShop during the upload.

We would need to investigate with a backend and FTP access. Could you provide that via our contact form ?
[ www.hikashop.com/support/contact-us.html](https://www.hikashop.com/support/contact-us.html)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 2 months ago [\#354529](#354529) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354529 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

just sended through cf

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86283
- Thank you received: 14262
-
-

3 years 2 months ago [\#354579](#354579) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#354579 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi,

The backend access you provided didn't work.

So I did some debugging with just the FTP access. I found today that contrarily to when I looked at the situation on your website 4 days ago ( [ www.hikashop.com/support/forum/checkout/...c-350311.html#354456](https://www.hikashop.com/support/forum/checkout/906854-upload-fail-topic-350311.html#354456) ) when it worked, the CSRF flag is not added to the AJAX upload request anymore.
I checked with FTP and I can still see the patch I've added a week ago.
I can also see the new code in the javascript to handle the CSRF flag on your page.
So this means that some of the javascript is not properly initialized on the page.
I think it comes from the javascript errors you have there:
[ i.imgur.com/NpQ7CJI.png](https://i.imgur.com/NpQ7CJI.png)
I think they are linked to a PayPal plugin. The error says that the client id is missing somehow.
However, I checked the cached JS of JCOptimize and I can see the client id in the URL:
[ i.imgur.com/WmmFo8d.png](https://i.imgur.com/WmmFo8d.png)
So there might be some incompatibility with the JS SDK file of PayPal and JCHOptimize. I would recommend two things:
- JCHOptimize must have an option to turn off the caching of external files. Try turning this off and clearing the cache once. That should hopefully fix the javascript errors.
- This JS SDK file is only there to display messages on the product page. So it's not a crutial part. Supposing that you're using the PayPal Checkout plugin in HikaShop, there are display settings you can turn off in the payment method to not display these messages on the frontend listings / product details page / cart page, etc. Turn them off and then clear the JCHOptimize cache and it should fix the javascript errors.
Once the JS errors are fixed, the CSRF flag should be added to the AJAX upload request again, and the upload should work again without modifications in the code of HikaShop.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 1 month ago [\#355041](#355041) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#355041 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi Nicolas,

I contacted Samuel from JCHOptimize again about this and he investigated the issue. This is what he replied:

*The problem is that HikaShop is not accessing the correct CSRF token when the HTTP Request setting is enabled. I'll try to explain.

Joomla will publish the CSRF token in a script here:

[ i.imgur.com/O2YyMCU.png](https://i.imgur.com/O2YyMCU.png)

When the HTTP Request setting is disabled, and the page is cached, JCH Optimize will update the correct CSRF token in the cached HTML page before sending it to the user, as each user will have a unique token. In these cases, with HTTP Request disabled, the upload works without issues.

If you enable the HTTP Request setting, the static cached HTML page is served without calling PHP using URL rewrite from the server level to reduce server response time significantly. This means JCH Optimize cannot modify the actual HTML page since this would need to be manipulated by PHP. In this case, a small script updates the correct CSRF in the DOM. So, while the outdated CSRF token is still on the HTML page, if you use the browser's development tool to access the DOM loaded in the browser, you'll find the updated and correct CSRF:

[ i.imgur.com/SOyhiJ0.png](https://i.imgur.com/SOyhiJ0.png)

It seems HikaShop is reading the token from the HTML sent to the browser, rather than accessing the script in the DOM itself, so the upload fails. If HikaShop can correct this, it should work.*

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86283
- Thank you received: 14262
-
-

3 years 1 month ago [\#355044](#355044) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#355044 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Hi,

Thanks for the message.

HikaShop actually doesn't do either of this.
When you're triggering the upload of a file on the page, the HikaShop javascript will now call Code:

Joomla.getOptions("csrf.token", "")

in order to get the current CSRF token served by the Joomla javascript.
If HikaShop is getting the old CSRF token when doing this, it means that on top of updating the DOM with the JSON, JCHOptimize should also update the data in the Joomla object. As far as I know, the way I did it is the proper way to read the CSRF token on the client side for an extension.
Or maybe I'm missing something ?
Please understand that I'm not familiar with how JCHOptimize works.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

3 years 1 month ago [\#355051](#355051) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[upload fail topic #350311](/forum/27-checkout/906854-upload-fail-topic-350311#355051 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 4.3.3 -- PHP version -- : 8.1 -- Error-message(debug-mod must be tuned on) -- : upload fails with JCH  Hi,  In the improvements of version 4.7.4 this item was mentioned:  • The AJAX upload system can now work even on pages where JCH Optimize is configured to cache the javascript.  But I still have the same upload error (bar turning red) with JCH optimize active?  I made the changes again in the upload.php files to get it working. So you can not test on our website.")*

Thanks, I will forward this to Samuel.

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwNjg1NC11cGxvYWQtZmFpbC10b3BpYy0zNTAzMTE/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.448 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
