Remote File upload in grails

后端 未结 2 1852
轮回少年
轮回少年 2021-01-03 01:12

I am creating a webapplication using grails which uses lot of ajax.I want to implement file upload using ajax.I dont know how to use ajax for file upload.My sample GSP code

2条回答
  •  生来不讨喜
    2021-01-03 01:35

    Uploading a file via Ajax is not really possible. You can still upload a file in the background using a hidden iframe and either evaluate the repsonse (which is then inside the iframe) or fire another ajax call after the upload is complete.

    
        File: 
        
    
    
    
    
    
    

    Another option is to use a flash based uploading mechanism (eg. swfupload) instead of the iframe.

提交回复
热议问题