Next.js Discord

Discord Forum

file upload

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
im trying to create a file uploader that works like this. the user uploads the file and a link gets generated and after i performed some actions with the link, the file gets deleted and so does the link. anybody has any ideas on how to do so? i already implemented a simple file uploader in my ui with shadcn, but i dont really know how to take it from there. any help is appreciated

42 Replies

after i performed some actions with the link
are these actions clientside or serverside?
@American black bear
American black bearOP
to be more clear, i need to make a post request that contains the link and after i get back the 200 response i can delete the video and the link
and you can't do the stuff that you want to do while uploading? Because: upload file = server side, file edit = server side
Why not both in one?
the thing in struggling to get is a link to the video cause i need the video to be a link basically
thats the main issue im struggling with
i need the video to be a link
why?
@B33fb0n3 > i need the video to be a link why?
American black bearOP
cause it is required by the meta api
@American black bear cause it is required by the meta api
American black bearOP
i want to post a video to instagram and it requires the video to be a link basically
are you able to share your code please?
or your git repo
@B33fb0n3 are you able to share your code please?
American black bearOP
i havent done much yet tbh, i created a basic file uploader
let me show you
this is the file uploader, it is inside of a form
yea I mean the backend part lol
American black bearOP
i havent done anything yet in backend cause i dont have any idea where to start from. bare in mind that im really new to nextjs
@American black bear i havent done anything yet in backend cause i dont have any idea where to start from. bare in mind that im really new to nextjs
American black bearOP
if it is too much stuff to explain to me dont worry ill try to figure it out by myself
well... I tried many times myself to upload and answer comments on meta... and I never figured their api out... so yea.. it will be kinda hard for you. Maybe we can resolve this issue together?
i watched their api docs and they say this about uploading reels to instagram using the api
in the example they use a picture but it is the same for reels
ok got it. So what do you think about uploading it to a public storage like s3 or something else, got the url and publish it via the url. We will get a response from meta and when we got the response we can either safe the id with your files or directly delete the file. We do technically things next, but up to here everything sounds right?
yea I think to too. I think they just need a unique way to get the files. And to get a unique way they do it via a direct url to the file. Step on to the technical things?
ok, we have multiple steps:
1. uploading it to a public storage like s3 or something else
2. got the url (to public file)
3. publish it via the url
4. ...
we can look at 4. 5. and so on when we are there. Am I missing something?
you are not missing anything tho i think this is it
4th and 5th step would be cleanup
American black bearOP
yeah exactly
Ok, let's start with 1.
You already have a storage like s3 to be able to store files and publish them?
American black bearOP
i do not unfortunately
I personally prefer s3. Maybe you want to hop on in a quick call?
@B33fb0n3 I personally prefer s3. Maybe you want to hop on in a quick call?
American black bearOP
right now its pretty late where im at, i can definetly do a call tomorrow tho without any problem
ok, wrote you a dm
@American black bear consider using https://github.com/TimMikeladze/next-upload for your file uploading needs
It integrates with s3, nextjs and streamlines file uploading to end to end to make it as simple as possible