Skip to content

Latest commit

 

History

History

edit_upload_file

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Edit Screen: Upload a File to the Server on Button Click

In this article, I will show how to upload a file to the server on button click and store the file name and its (unique) file id in a separate nuBuilder Text object.

1. In your Form, add a HTML object.

Type: HTML
Label: Upload File
ID: upload_html
HTML: Add the code from input_type_file.htm.

The HTML object holds code which creates a file upload object and processes the file upload

2. Add a Text Object

Type: Input (Text)
Label: Filename
ID: file_name (e.g.)
Width: 150

Also create this column in your database table (in phpMyAdmin). Type: VARCHAR(100)

This object is used to store the filename that is returned by the PHP script.

3. PHP Script

Place the upload_file.php in the folder /libs/upload/
Edit the permitted file types allowed for the file upload. Change the upload directory ($uploaddir) if necessary.

4. Create the upload folder

Create a new folder with the name files in the folder /libs/upload/