Uploading a file with twig and Slim framework (Version 2) - PHP

前端 未结 1 1762
再見小時候
再見小時候 2021-01-18 05:03

I\'m using UserFrosting a user management system and I\'m having some trouble uploading a file through form post, this is what I tried

This is how my twig fi

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 05:24

    This answer is assuming you're using UserFrosting, since you linked this question in the UserFrosting Gitter chat.

    UserFrosting includes CSRFGuard Middleware to make sure all POST requests originated locally. You need to include the CSRF token to ensure that the middleware does not block the POST request.

    Since the token is already in the Twig global variables, the easiest way is to use a hidden form field with the CSRF token in it:

    
    

    0 讨论(0)
提交回复
热议问题