Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Feature: Allow requests without files #83

Closed
warappa opened this Issue · 5 comments

2 participants

@warappa

I have the following situation:

In an entity edit-form a user can select an image via <input type="file"/>. Additional data like firstname, lastname,... are sent within this request.

If the user doesn't want to change/set an image, I still want to send the other form-data.

Right now it stops before sending the request at the following line in FileAPI.core.js:

if( ( proxyXHR.statusText != 'abort' || proxyXHR.current ) && data ){

because data (file) is undefined because no file is specified.

I think it should be possible to send the data without any files because if it's not, I only have the following options left:

  • send a dummy file (not so good)
  • use another send algorithm in no-file-case (worst)

What do you think?

Lg
warappa

@RubaXa
Owner

I agree with you, thought long over this situation, will try to do this week.

@RubaXa
Owner

Done, you can try in "dev" branch.

@ghost

In IE < 10 we have problems with XHR._send.

In Flash.XHR._send we are falling back to parent _send if we haven't any real files to send. But our formData is not in htmlForm, so we're going to the single piece upload part and crashing on

    var bytes = Array.prototype.map.call(data, function(c){ return c.charCodeAt(0) & 0xff; });
    xhr.send(new Uint8Array(bytes).buffer);

cause IE < 9 doesn't have Array.map and Uint8Array

For the workaround, I've extended toData meth in Flash.Form patch by simple checking existance of files in items and fallback to the parent if we haven't any.

@RubaXa
Owner

Oops, you're right, will correct soon.

@RubaXa RubaXa closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.