3

我有一个分布在多个页面上的表单。该表单有多个字段,(文本、图像、电子邮件等。)我想在用户选择图像后立即上传唯一的图像,但除非用户完成所有字段,否则不应提交表单。我正在使用 CarrierWave::RMagick

4

1 回答 1

0

This can be done using JavaScript. Make use of onchange event to post the data, for example refer to this SO thread. If you don't want to reinvent the wheel on JavaScript front, you can use exisiting JavaScript library like BlueImp JQuery File upload to submit photo to server.

On Ruby side you can have an endpoint(controller method POST) which would accept image and probably an identifier to signify what scenario the image has been submitted for.

于 2013-11-08T08:41:56.090 回答