Coder Social home page Coder Social logo

Comments (4)

jimmywarting avatar jimmywarting commented on June 15, 2024

When you call method formData.get it will try to normalize the value

return map[name] ? normalizeValue(map[name][0]) : null

FormData/FormData.js

Lines 69 to 79 in f18bd6e

function normalizeValue([value, filename]) {
if (value instanceof Blob)
// Should always returns a new File instance
// console.assert(fd.get(x) !== fd.get(x))
value = new File([value], filename, {
type: value.type,
lastModified: value.lastModified
})
return value
}

The probable cause is that the window.File is not a constructor

I try to work around it by using Blob as a fallback and also assign File to window but for some reason it don't seem to do so for you..?

FormData/FormData.js

Lines 34 to 67 in f18bd6e

// Fix so you can construct your own File
try {
new File([], '')
} catch (a) {
global.File = function(b, d, c) {
const blob = new Blob(b, c)
const t = c && void 0 !== c.lastModified ? new Date(c.lastModified) : new Date
Object.defineProperties(blob, {
name: {
value: d
},
lastModifiedDate: {
value: t
},
lastModified: {
value: +t
},
toString: {
value() {
return '[object File]'
}
}
})
if (stringTag) {
Object.defineProperty(blob, stringTag, {
value: 'File'
})
}
return blob
}
}

Could you try if File constructor exist in QTWebKit and maybe investigate why it aint able to set a tiny Blob polyfill to the global window?

from formdata.

Enum1109 avatar Enum1109 commented on June 15, 2024

Thank you for the reply.
Unfortunately, File constructor doesn't exist in QTWebKit.

from formdata.

jimmywarting avatar jimmywarting commented on June 15, 2024

Unfortunately, File constructor doesn't exist in QTWebKit.

Not sure why this line does not work...

   global.File = function(b, d, c) {...}

Think that is something you need to figure out first.

from formdata.

Enum1109 avatar Enum1109 commented on June 15, 2024

Thank you for your prompt response. I'll keep digging......

from formdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.