Page 1 of 1

upload file longBLOB

Posted: Fri May 13, 2022 5:27 am
by cjuliao
hello

Can someone guide me, to upload a file to a longblod field that has the following characteristics and then download it?
zprs_file_blob
zprs_file_name
zprs_file_type
I had it solved before with the nubulder 4 version.
With version 4.5 I could not

I appreciate the help please

Re: upload file longBLOB

Posted: Fri May 13, 2022 5:58 am
by kev1n
Hi,

How did you solve it with v4? What doesn't work with 4.5?

Re: upload file longBLOB

Posted: Fri May 13, 2022 5:46 pm
by cjuliao
Hi, thanks for your attention.

Use an Iframe to upload the file.
Iframe Php to run file: upload file
Php code
$h = "

<html>
<body style='background-color:lightgrey'>

<form enctype='multipart/form-data' action='nuupload.php' method='POST'>
<input name='userfile' type='file' />
<input type='submit' value='Send File' />
</form>

</body>
</html>
";
print $h;

In the after save of the form

$J = json_decode("#FILES#");

if($J[0]->name == ''){return;}

$dt = new DateTime();

$date = $dt->format('Y-m-d H:i:s');


$name = $J[0]->name;
$type = $J[0]->type;
$size = $J[0]->size;


$uploaddir = sys_get_temp_dir();

$contents = file_get_contents($uploaddir . '/' . $J[0]->name);
$contents = addslashes($contents);
nuDebug($contents);


$s = "
UPDATE plan_inversiones
SET
zprs_file_blob = '$contents',
zprs_file_name = '$name',
zprs_file_type = '$type',
sfi_size = '$size',
zzzsys_file_log_changed_at = '$date'

WHERE pai_id = '#RECORD_ID#'
";

nuRunQuery($s);

unlink('tmp/' . $J[0]->name);

Re: upload file longBLOB

Posted: Sun May 15, 2022 7:56 pm
by kev1n
What code is in nuupload.php?

Re: upload file longBLOB

Posted: Mon Jul 18, 2022 8:59 pm
by kev1n
Is this solved?