开发者

Submit a radio button as a file input

开发者 https://www.devze.com 2022-12-21 01:08 出处:网络
I have a set of radio buttons with values like this: <input type=\"radio\" value=\"http://www.foo.com/image1.jpg\" />

I have a set of radio buttons with values like this:

<input type="radio" value="http://www.foo.com/image1.jpg" />
<input t开发者_StackOverflowype="radio" value="http://www.foo.com/image2.jpg" />
<input type="radio" value="http://www.foo.com/image3.jpg" />

But on submit I'd like it to treat the selected radio as if it were a file input, using the value as it's value. I'd also like to do this with only HTML if at all possible, but if not I'm willing to use jQuery. Any thoughts?


This will not work.

In order for something to work as file input, the file needs to exist on local filesystem - and you can not get your web page to automatically save the file from a URL to a filesystem due to JS security restrictions.

0

精彩评论

暂无评论...
验证码 换一张
取 消