Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hc does not support file uploading #422

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Conversation

yusukebe
Copy link
Member

No description provided.

@yusukebe yusukebe merged commit 38eb65d into main Jun 27, 2024
@yusukebe yusukebe deleted the does-not-support-file-uploading branch June 27, 2024 01:36
@movahhedi
Copy link
Contributor

I am literally using hc to upload files! how is this not possible? With "form".

client

const submitResponse = await client.api.entity["article-image"][":id"].edit.$post(
	{
		param: { id: "" + thisId },
		form: {
			file: new File([fileToUpload], filename, {
				type: fileToUpload.type,
			}),
		},
	},
);

server

.post(
	"/:id/edit",
	zValidator(
		"form",
		z.object({
			file: z.instanceof(File).optional(),
		}),
	),
	// ...

@yusukebe
Copy link
Member Author

@movahhedi

I think you can do it! Isn't it working well?

@movahhedi
Copy link
Contributor

movahhedi commented Jul 11, 2024

Yes, and brilliantly. I don't know why you added this note. I think it should say "File uploading is currently only available using form", and provide the example i sent below it.

@yusukebe
Copy link
Member Author

@movahhedi

I don't know why you added this note.

Honestly, I also don't remove why I add this note:)

So, removing this note and adding an example like the one you wrote would be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants