SoAanyip / React-FileUpload

Upload files async with xhr2 or iframe for IE. Supporting IE8+. React component.
310 stars 95 forks source link

Backwards compatibility for non-IE browsers #29

Open vegetabill opened 7 years ago

vegetabill commented 7 years ago

I wanted to use this component for a mobile website and we wanted to support older Android browsers.

Currently, the implementation is too specific to checking for IE. If possible, please use feature detection instead so that old non-IE browsers will get the fallback form implementation.

I also need the fallback form to render the paramAddToField fields as hidden fields so that the Rails CSRF token is included, otherwise the request will be rejected.

vegetabill commented 7 years ago

I added my own form children like this to include the CSRF token but it didn't end up in the page markup.

       <FileUpload options={fileUploadOptions}>
           <a ref="chooseAndUpload">
             Edit Photo
           </a>
          <input name="authenticity_token" type="hidden" value={this.context.csrfToken} />
        </FileUpload>