Skip to content

Commit

Permalink
update: few changes in providing data
Browse files Browse the repository at this point in the history
  • Loading branch information
Madani Badaoui committed Jul 17, 2024
1 parent 0448cd1 commit 30294cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dev/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ServerExample {

responseJson.success = 1;
responseJson.file = {
url: image.filepath,
url: 'file://' + image.filepath,
name: image.newFilename,
size: image.size
};
Expand Down
4 changes: 2 additions & 2 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ export interface ImageConfig {
/**
* Field name for the uploaded image.
*/
field?: string;
field: string;

/**
* Allowed mime-types for the uploaded image.
*/
types?: string;
types: string;

/**
* Placeholder text for the caption field.
Expand Down
4 changes: 2 additions & 2 deletions src/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class Uploader {
// custom uploading
if (this.config.uploader && typeof this.config.uploader.uploadByFile === 'function') {
const uploadByFile = this.config.uploader.uploadByFile;
upload = ajax.selectFiles({ accept: this.config.types || 'image/*'}).then((files: File[]) => {
upload = ajax.selectFiles({ accept: this.config.types}).then((files: File[]) => {
preparePreview(files[0]);

const customUpload = uploadByFile(files[0]);
Expand Down Expand Up @@ -181,7 +181,7 @@ export default class Uploader {
*/
const formData = new FormData();

formData.append(this.config.field || 'image', file);
formData.append(this.config.field, file);

if (this.config.additionalRequestData && Object.keys(this.config.additionalRequestData).length) {
Object.entries(this.config.additionalRequestData).forEach(([name, value]: [string, any]) => {
Expand Down

0 comments on commit 30294cc

Please sign in to comment.