Skip to content

Commit

Permalink
Update path/to/pages/admin.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
gitauto-ai[bot] authored Apr 25, 2024
1 parent a554b41 commit 8295efa
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions path/to/pages/admin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<form onSubmit={handleUploadSubmit}>
<input type="file" onChange={(e) => setSelectedFile(e.target.files[0])} />
<select onChange={(e) => setSelectedFolder(e.target.value)}>
{folders.map((folder) => (
<option value={folder.name}>{folder.name}</option>
))}
</select>
<button type="submit">Upload</button>
</form>
@@ -50,0 +65,9 @@
const handleUploadSubmit = async (event) => {
event.preventDefault();
const formData = new FormData();
formData.append('file', selectedFile);
formData.append('folderName', selectedFolder);
const response = await fetch('/api/photos/upload-photo', { method: 'POST', body: formData });
const data = await response.json();
console.log(data);
};

0 comments on commit 8295efa

Please sign in to comment.