sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 129 forks source link

AWS Astro example doesn't work #406

Closed garysassano closed 1 month ago

garysassano commented 1 month ago

When clicking the "Upload" button, it opens the "Save as" dialog window and then saves the file to my local instead of uploading it to S3.

zohaibakber commented 1 month ago

https://ion.sst.dev/docs/start/aws/astro/#3-create-an-upload-form

window.location.href = image.url.split("?")[0] || "/";

this line is saving file in local machine example is correct and works fine maybe you are doing something wrong?

garysassano commented 1 month ago

You're saying the example sets up an unused S3 bucket and has an "Upload" button that doesn't actually upload to S3. Instead, it takes a file from the user's computer and saves it somewhere else, still on their computer? This seems illogical and confusing.

jayair commented 1 month ago

Yeah try commenting out the line @zohaibakber said and see what's going on

garysassano commented 1 month ago

Commenting the line works indeed, but I'm not sure I understand why that's present.

jayair commented 1 month ago

It shows that the file was uploaded and that you can download it back.

garysassano commented 1 month ago

The "Upload" button's current behavior of prompting to save the file locally is counterintuitive. I would normally expect a popup ("File upload successful" or an error message) after clicking "Upload".

You could add a dropdown menu listing files in the bucket and a separate "Download" button would provide a clear and intuitive way to access uploaded files.

jayair commented 1 month ago

Yeah I might change this at some point. For now it's a very simple demo that shows that a file is getting uploaded correctly.

iamandrewluca commented 1 month ago

You're saying the example sets up an unused S3 bucket and has an "Upload" button that doesn't actually upload to S3.

It uploads to S3, then tells your browser to open that file from S3, but the browser decides to download the file from S3.