You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB

3 years ago
  1. <urban-filemanager-upload>
  2. <div class="file-upload">
  3. <div class="file-upload">
  4. <form onsubmit={ } enctype="multipart/form-data">
  5. <input name="files[]" type="file" multiple onchange={ handleChange }>
  6. </form>
  7. <div class="file-upload__item" each={ file in state.files }>
  8. { file.name } / { file.size }
  9. </div>
  10. </div>
  11. </div>
  12. <script>
  13. /**
  14. *
  15. * parent Directory
  16. *
  17. *
  18. *
  19. */
  20. export default {
  21. state: {
  22. files: []
  23. },
  24. /**
  25. *
  26. *
  27. * @param Object event
  28. *
  29. */
  30. handleChange(event) {
  31. console.log(event.target.files)
  32. this.state.files = event.target.files
  33. this.update()
  34. }
  35. handleUpload(event) {
  36. const config = {
  37. onUploadProgress: progressEvent => console.log(progressEvent.loaded)
  38. }
  39. axios.post('/api/upload/' + id, formData, config)
  40. .then(function (response) {
  41. currentObj.success = response.data.success;
  42. })
  43. .catch(function (error) {
  44. currentObj.output = error;
  45. })
  46. }
  47. }
  48. </script>
  49. </urban-filemanager-upload>