Trying to use file upload to insert filename into database field

i’ve been trying to follow the video on fileupload with the older dmxzone file upload extension but having hard time following it. Is there any updated documentation on how to do that within Wappler?

Obviously learning alot and feel this is a new great tool but I recognize the documentation is just evolving and there is so much there which is exciting to learn.

Thanks,
Rick

Hello Rick,

You should not be following old DW extensions docs, but instead follow Wappler’s official documentation: https://docs.wappler.io/t/inserting-uploaded-file-names-in-a-database/4234

I needn’t of blurred the further steps. If you are interested and after you have been successful with the above I am willing to explain them to you. They are carrying out re-sizing of the uploaded image to a thumbnail and storing it’s location (same principle as above with using the Path) within the DB alongside the original image.

thanks. I got it to work. Question: I have a form which updates a bunch of fields similar to the university detail page. One of the fields is a filename for an image. I can upload the image separately. Is it possible to add a file upload field on the update form which already contains the filename filed and image so that when I change the file upload field, it uploads the file and updates the value of the filename field on the form so when the database update step executes, the new filename is placed in the database. Currently, I tried a change dynamic event on the fileupload field and tried to set value of the form filename field to the value of the upload file name valute. That doesn’t change anything. Is there a better way to do this or am I trying to do too much on the same form?

Thanks,
Rick

Hi Rick,
This should be done in the update record step. Use the condition field, to tell the update step to insert a value only when a file is selected in the file field:

thanks that worked. I had to guess at how to code the condition in the server connect but got it to work. Is it correct that the condition exists is simply having the field name as the condition? I originally thought of " field is not null" or field is null or field= NULL. as I couldn’t find any documentation on that.

Really like Wappler though. There is obviously so much power everywhere.

Thanks,
Rick

It’s as simple as selecting the input from the data picker. That means - if the input has a value the condition is true and the insert for this database field will be executed, otherwise it’s false and no insert will be executed.

I know this is an old post, but it is related to my issue. I can insert images just fine. It is the update page that is giving me problems.

If I upload a new image, it goes in, but if I just update content, it uploads to the folder but doesn’t add it to the database.

File upload info.

My update behavior. **Note: If I click on the name in the file properties, it changes it to image[0].name. Which didn’t work either.

I even tried to reverse the above, but when I update it, no image goes in.

Any help is greatly appreciated.

Are you sure under $_POST variables in the Input section of the server action, the images POST variable is set as File?

That made a difference. Thank you for the assistance.

I was looking at an older walkthrough, so it looked a little different.

Have a good one :smiley:

1 Like