debug: add client-side logging for recipe image upload
All checks were successful
CI / update (push) Successful in 1m22s
All checks were successful
CI / update (push) Successful in 1m22s
Add console logging in the browser to track image selection and form submission: - Log when user selects an image file in CardAdd component - Log file validation steps (MIME type, size) - Log form submission and FormData preparation - Log whether image is being appended to form This helps diagnose if the issue is client-side (image not selected/sent) or server-side (image not received/processed).
This commit is contained in:
@@ -294,12 +294,24 @@ button.action_button {
|
||||
enctype="multipart/form-data"
|
||||
use:enhance={() => {
|
||||
submitting = true;
|
||||
console.log('[RecipeAdd:Client] Form submission started');
|
||||
console.log('[RecipeAdd:Client] Selected image file:', {
|
||||
hasFile: !!selected_image_file,
|
||||
fileName: selected_image_file?.name,
|
||||
fileSize: selected_image_file?.size,
|
||||
fileType: selected_image_file?.type
|
||||
});
|
||||
return async ({ update, formData }) => {
|
||||
// Append the image file if one was selected
|
||||
if (selected_image_file) {
|
||||
console.log('[RecipeAdd:Client] Appending image to FormData');
|
||||
formData.append('recipe_image', selected_image_file);
|
||||
} else {
|
||||
console.log('[RecipeAdd:Client] No image to append');
|
||||
}
|
||||
console.log('[RecipeAdd:Client] Sending form to server...');
|
||||
await update();
|
||||
console.log('[RecipeAdd:Client] Form submission complete');
|
||||
submitting = false;
|
||||
};
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user