Hello
How can I download a longblog file using a download button? How can I download it in Nubuilder 3?
Can I write you in Spanish?
Nubuilder 2 Code:
// get record from db using parameter passed through runIt() via a hash id
$sql ="SELECT * FROM documentos where doocumento_id='#recordID#'";
nuDebug($sql);
$rs=nuRunQuery($sql);
$fileObj=db_fetch_object($rs);
// set headers
header ("Content-type:$fileObj->archivo_file_type");
header("Content-Disposition:attachment;filename=$fileObj->archivo_file_name");
header("Pragma:private");
header("Cache-control:private.must-revalidate");
// echo file data
echo $fileObj->archivo;
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Download Longblog
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: Download Longblog
cjuliao,
You should be able to create a Procedure and run it from a Form via a Extra Action Button with nuRunPHP() http://wiki.nubuilder.net/index.php/Jav ... C_id.5D.29
(#recordID# will need to be #RECORD_ID#)
Steven
You should be able to create a Procedure and run it from a Form via a Extra Action Button with nuRunPHP() http://wiki.nubuilder.net/index.php/Jav ... C_id.5D.29
(#recordID# will need to be #RECORD_ID#)
Steven
-
- Posts: 7
- Joined: Fri Mar 23, 2012 2:58 am
Re: Download Longblog
the code does not work
I have bad?
nuRunPHP(pCode [, id])
OBJECT
type : Button
Events :
Event Name: onclick
Javascript: nuRunPHP(SHOWFILE_DOCUMENT,doocumento_id);
PHP Code
Details
Code: SHOWFILE_DOCUMENT
Description: muestra_archivos
Group: Display Files
Criteria Form:
Allow Non Secure Acces: NO
PHP CODE
PHP: //$sql ="SELECT * FROM documentos where doocumento_id=#RECORD_ID#";
nuDebug($sql);
$rs=nuRunQuery($sql);
$fileObj=db_fetch_object($rs);
// set headers
header ("Content-type:$fileObj->archivo_file_type");
header("Content-Disposition:attachment;filename=$fileObj->archivo_file_name");
header("Pragma:private");
header("Cache-control:private.must-revalidate");
// echo file data
echo $fileObj->archivo;
I have bad?
nuRunPHP(pCode [, id])
OBJECT
type : Button
Events :
Event Name: onclick
Javascript: nuRunPHP(SHOWFILE_DOCUMENT,doocumento_id);
PHP Code
Details
Code: SHOWFILE_DOCUMENT
Description: muestra_archivos
Group: Display Files
Criteria Form:
Allow Non Secure Acces: NO
PHP CODE
PHP: //$sql ="SELECT * FROM documentos where doocumento_id=#RECORD_ID#";
nuDebug($sql);
$rs=nuRunQuery($sql);
$fileObj=db_fetch_object($rs);
// set headers
header ("Content-type:$fileObj->archivo_file_type");
header("Content-Disposition:attachment;filename=$fileObj->archivo_file_name");
header("Pragma:private");
header("Cache-control:private.must-revalidate");
// echo file data
echo $fileObj->archivo;