Storing the uploaded file name in your database is an easy task in Server Connect.
You already know HOW TO UPLOAD A FILE so this will be just an addition to it, showing how to store the uploaded file name in your database.
You already have your upload page, with the upload server action set up. Now we will just extend the existing server action. Open the server connect panel:
You can either store just the file name (1) or the file URL (2).
Storing the file name only, will require to manually add the path to the file on the pages where you are going to use this info and use a dynamic value for the file.
Storing the URL will allow you to bind the whole url to the file on your pages.
Firstly, thank you for providing these very useful file upload tutorials. I have also added a table on the same page which lists the uploaded files and provides the download links. However, I have not found a way to auto refresh the table after the file has been uploaded. Is there some kind of auto refresh option?
Hello Eddie,
This is useful if you for example are using image upload, which creates several image sizes and you don’t want to store every version (size) in your database. So let’s say you upload, resize and save 3 versions: image.jpg, thumb_image.jpg and square_image.jpg
Then you can always call the same filename from your database and add add the path and prefixes where needed in your page template: