Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get file extension from clipper-upload #37

Closed
Domynos opened this issue Jul 22, 2019 · 3 comments
Closed

Get file extension from clipper-upload #37

Domynos opened this issue Jul 22, 2019 · 3 comments

Comments

@Domynos
Copy link

Domynos commented Jul 22, 2019

Hello,

Is there a way to get the original filename from clipper-upload component ? As you bind v-model with window.URL.createObjectURL(this.file), i can't have access to original file extension, right ?

Thanks for the plugin by the way.

@timtnleeProject
Copy link
Owner

Hi @Domynos ,
You can get the upload file object through the clipper-upload data file.

<clipper-upload  $ref="upload" />

Then you can get the File object after either:

  • Dom-string updated
  • inside clipper-upload on input event callback. (ex: <clipper-upload $ref="upload" @input="cb" />)
  • image using that dom-string is loaded. (ex: <clipper-basic :src="src" @load="cb">)
this.$ref.upload.file // get the File object

@Domynos
Copy link
Author

Domynos commented Jul 23, 2019

Hi @timtnleeProject

I didn't know I could access to child component like that. Thank you, I learned something!
Your syntax didn't work in my case maybe due to different vuejs versions ?

I had to use :
<clipper-upload ref="upload/> (instead of $ref)

and access it by

this.$refs.upload.file

Reference : https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements

Thank you for the quick answer.

@Domynos Domynos closed this as completed Jul 23, 2019
@timtnleeProject
Copy link
Owner

I had to use :
<clipper-upload ref="upload/> (instead of $ref)

You're right, that's a typo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants