# Create a photo upload form, fast

**URL:** <https://forum.wixstudio.com/t/create-a-photo-upload-form-fast/20241>\
**Category:** Show and tell\
**Tags:** tips, code\
**Created:** [June 2, 2020, 11:17am UTC](https://forum.wixstudio.com/t/create-a-photo-upload-form-fast/20241 "2020-06-02T11:17:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![av-promotional](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/av-promotional/32/2796_2.png) [@av-promotional](https://forum.wixstudio.com/u/av-promotional)\
**Post date:** [June 2, 2020, 11:17am UTC](https://forum.wixstudio.com/t/create-a-photo-upload-form-fast/20241/1 "2020-06-02T11:17:40Z")

</div>

We often use a photo upload form, in the past I would use the photo upload procedure in the form submitting this way:

```javascript
if ($w("#uploadButton1").value.length > 0) { 
    $w("#uploadButton1").startUpload()
      .then( (uploadedFile) => {
       $w('#image31').src = uploadedFile.url
      insert = {
 "title": $w('#input1').value,
 "image" : uploadedFile.url
 }

```

This works well, but slows down the form submission process until the image upload process is complete, especially if there are some images to upload.

I would like to share with you the way in my opinion better.  
As soon as the image is selected, the image upload process will take place, so that the user can continue the form process as the site does the upload work, and when the form is submitted, everything is ready.

```javascript
export async function uploadButton1_change(event) {
 let file = $w('#uploadButton1').value;
 if (file.length > 0) {
 let response = await $w('#uploadButton1').startUpload($w('#uploadButton1').buttonLabel = 'loading...');
 if (response) {
            $w('#image31').src = response.url
            $w('#uploadButton1').buttonLabel = "Replace image"
        }
    }
}

```

Submitting the form can now be associated with the image itself

```javascript
insert = {
  "title": $w('#input1').value,
  "image" : $w('#image31').src,
    }

```
