Print

File



This object allows a file to be uploaded to a BLOB data type.



If that fieldname is pdf_copy, for example, nuBuilder will automatically create 3 more fields called
pdf_copy_file_size, pdf_copy_file_type and pdf_copy_file_name.

These fields will hold information about the type of file uploaded, that can be used to extract it and display it in the browser.

//this code is from a Procedure Activity.
 
//get record from db using parameter passed through runIt() via a hash id
 
$sql     = "SELECT * FROM transaction WHERE transaction_id = '#runIt1#'";
$rs      = nuRunQuery($sql);
$fileObj = db_fetch_object($rs);
 
//set headers
 
header("Content-type: $fileObj->big_test_file_type");
header("Pragma: private");
header("Cache-control: private, must-revalidate");
 
//echo file data
 
echo $fileObj->big_test;



This Procedure was called by the following javascript..

//The first parameter is the code for the Procedure (Activity) to be run.
//The second is used in the php code via the hash variable #runIt1#.
 
runIt('SHOWDOC', nuGetRowId());
 
//This is for a Subform.
//For a Form, you would use nuGetFormId() instead of nuGetRowId()





When a file has been uploaded the tick box directly to the right of the File Object will be unticked and hovering the cusor over it will display the name of the file currently stored in it.



Having this box ticked when saving the record will delete the contents of this field.





Created by: steven. Last Modification: Tuesday 11 of December, 2012 06:06:34 CST by steven.