Loading an image to a >

后端 未结 6 843
闹比i
闹比i 2020-11-30 23:06

I\'m trying to load an image selected by the user through an element.

I added a onchange event handler to the input element like this:



        
6条回答
  •  Happy的楠姐
    2020-11-30 23:28

    Andy E is correct that there is no HTML-based way to do this*; but if you are willing to use Flash, you can do it. The following works reliably on systems that have Flash installed. If your app needs to work on iPhone, then of course you'll need a fallback HTML-based solution.

    * (Update 4/22/2013: HTML does now support this, in HTML5. See the other answers.)

    Flash uploading also has other advantages -- Flash gives you the ability to show a progress bar as the upload of a large file progresses. (I'm pretty sure that's how Gmail does it, by using Flash behind the scenes, although I may be wrong about that.)

    Here is a sample Flex 4 app that allows the user to pick a file, and then displays it:

    
    
        
            
        
        
        
        
            
        
    
    

提交回复
热议问题