Shum
CCConvex Community
•Created by Shum on 5/12/2024 in #support-community
Error: Object literal may only specify known properties, and 'color' does not exist in type

3 replies
CCConvex Community
•Created by Shum on 5/4/2024 in #support-community
Reading an image that was storage in convex
I have uploaded an image to convex data base and it is stored properly. However i am now looking to fetch the image and display it:
const getFileUrl = (fileId: string) => {
const baseUrl = process.env.NEXT_PUBLIC_CONVEX_URL;
if (!baseUrl || !fileId) {
return "";
}
return
${baseUrl}/api/storage/${fileId}
;
};
useEffect(() => {
if (profileData && profileData[0]) {
const profileInfo = profileData[0];
const photoPreview = getFileUrl(profileInfo.photo);
setProfile({
...profileInfo,
photoPreview,
});
}
}, [profileData]);
^the above is my code but it is using the image id that I had storaged when following convex docs:
// Step 1: Get a short-lived upload URL
const postUrl = await generateUploadUrl();
// Step 2: POST the file to the URL
const result = await fetch(postUrl, {
method: "POST",
headers: { "Content-Type": "image/png" },
body: profile.photo,
});
const { storageId } = await result.json();
How do get the correct url to be used so I can display the image correctly?3 replies
CCConvex Community
•Created by Shum on 4/15/2024 in #support-community
Uploading a photo to profile
Hi, I am creating a profile page and I want the user to be able to upload their photo along w. their user details. Could anyone provide me some guidance on how to upload a photo along w. the other data (name, dob, and email) to the convex db?
12 replies
CCConvex Community
•Created by Shum on 3/27/2024 in #support-community
I am following the docs, but for some reason its not reading my createUser

3 replies