Comments (5)
Thanks, it works 😄
from file-upload-with-preview.
Because of some recent changes that we’re working through, you’re going to want to make sure you’re including the library at a certain version. To anyone coming to this issue with a new TypeError: FileUploadWithPreview is not a constructor
error, you should update your javascript library script import to <script src="https://unpkg.com/[email protected]/dist/file-upload-with-preview.min.js"></script>
. See below for another way to fix the issue, but may leave you with an error in the future. It’s pretty universally recommended to specify versions in dependencies for safety reasons.
Initial answer:
Hey, sorry about that - we made some changes today that affect the usage. You can either update your code to use .default on the initialization: var upload = new FileUploadWithPreview.default('myUniqueUploadId')
, or you can specify an older version - changing to 3.1.3 should solve the issue for you.
from file-upload-with-preview.
Hey Grzegorz - we just pushed a fix to the default
issue. If you have not hardcoded the version number in you importing of this library, then you may run into an issue with this latest push.
If you do run into an issue now, please use the following import code to lock in your version:
<script src="https://unpkg.com/[email protected]/dist/file-upload-with-preview.min.js"></script>
Also, you can remove the default
from your initialization. So it should look like this:
var upload = new FileUploadWithPreview('myUniqueUploadId')
Sorry for the trouble and for you having to update your code. Please let us know if we can assist further. Thank you.
from file-upload-with-preview.
Hello, I'm having the same problem importing from NPM into a JS file.
File plugins.js using webpack:
window.FileUploadWithPreview = require('file-upload-with-preview');
When I see in the browser, the error appears:
Uncaught TypeError: FileUploadWithPreview is not a constructor
My script into HTML
<script type="application/javascript">
const upload = new FileUploadWithPreview('uploadImage', { text: {chooseFile: 'Selecione um arquivo', browse: 'Selecionar'} });
</script>
from file-upload-with-preview.
on app.js
const FileUploadWithPreview = window.FileUploadWithPreview = require('file-upload-with-preview/src/file-upload-with-preview').default;
from file-upload-with-preview.
Related Issues (20)
- How to access already added images while editing a form? HOT 2
- FileUploadWithPreview is not a constructor (extended with examples) HOT 2
- May I use html_form submit to backend? HOT 2
- how to capture the event with jquery? HOT 1
- There is no name attribute to get the image on backed HOT 4
- Beginner overloaded HOT 2
- Can I use this inside react [just react] ? HOT 2
- Name attribute not present in sending request to server. HOT 6
- file_upload_with_preview__WEBPACK_IMPORTED_MODULE_4__.FileUploadWithPreview is not a constructor HOT 4
- Use in Next js and Tailwind HOT 3
- bug on chooseFile label HOT 2
- Question: can I attach event to element, not to window? HOT 12
- Save in local storage HOT 2
- How to attach to previously initialized instance of FileUploadWithPreview? HOT 4
- How to dynamically click the clear button? HOT 1
- Added event confusion with presets and new add HOT 3
- IE11 HOT 3
- How to Change Input file label? HOT 1
- Need to Show The Browse Button HOT 1
- Rendered order of PresetFiles
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from file-upload-with-preview.