Skip to content

hc does not support file uploading#422

Merged
yusukebe merged 1 commit intomainfrom
does-not-support-file-uploading
Jun 27, 2024
Merged

hc does not support file uploading#422
yusukebe merged 1 commit intomainfrom
does-not-support-file-uploading

Conversation

@yusukebe
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

@movahhedi

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

@movahhedi
Copy link
Copy Markdown
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
Copy Markdown
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.

abegehr added a commit to abegehr/website that referenced this pull request Mar 21, 2025
@abegehr abegehr mentioned this pull request Mar 21, 2025
yusukebe pushed a commit that referenced this pull request Mar 22, 2025
* Upload File Note

source: #422 (comment)

* indents
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