Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

upload file longBLOB

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
cjuliao
Posts: 13
Joined: Fri Mar 23, 2012 2:58 am
Has thanked: 1 time
Been thanked: 1 time

upload file longBLOB

Unread post 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
kev1n
nuBuilder Team
Posts: 4298
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: upload file longBLOB

Unread post by kev1n »

Hi,

How did you solve it with v4? What doesn't work with 4.5?
cjuliao
Posts: 13
Joined: Fri Mar 23, 2012 2:58 am
Has thanked: 1 time
Been thanked: 1 time

Re: upload file longBLOB

Unread post 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);
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4298
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: upload file longBLOB

Unread post by kev1n »

What code is in nuupload.php?
kev1n
nuBuilder Team
Posts: 4298
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: upload file longBLOB

Unread post by kev1n »

Is this solved?
Post Reply