Image preview before upload in IE and Chrome

前端 未结 7 2019
说谎
说谎 2021-02-14 19:51

I am trying to design a module in which I would like to show a preview of the image to the user before he uploads the image to database.

I have found a solution which wo

7条回答
  •  旧巷少年郎
    2021-02-14 20:24

    I concur with the nay-sayers who have already answered - local files are off limits by design.

    But, if you are really committed to this preview-before-upload feature, and willing to include some bumpy UX, you might circumvent the local/server question and...

    ...use an accompanying AIR application to handle image uploading for your web app.

    • Create a simple AIR application that allow users to select local images and displays them in thumbnails without uploading them.

    • You can check to see if user's have the app installed, at which point you can prompt them to install or launch it if it's already installed (see here for more on that). You could allow them to opt out and use a fallback upload system without thumbnail previews as well.

    • Once the images are selected and reviewed (or even resized or otherwise processed), the AIR app could upload them to your server directly.

    It's insane, I know, and probably doesn't fit your skill-set or expectations (based on the tags on this question) but I think it would work.

提交回复
热议问题