File upload via Webbrowser
Author: hansen@ahp-gmbh.de (-GHAN-)
Hello Community,
as i am involved in the headlined topic and encounter errors, i would like to know if somebody already has any experiences with fileload/web FileName,RawData !?
I' ending up in -25 Middleware error :) .... which actually turns to be my most favorite Message :)
Cheers,
// GHAN
7 Comments
Local Administrator
Hello,
after many tries in finished to understand that the first parameter doesn't reference an uniface field but the name of an input of the form.
for instance:
uniface code:
fileload/web "fichier",lv_contenu
html code:
<form target="_self" action="hguw0002.op_upload" enctype="multipart/form-data" method="post" name="formulaire">
<input name="fichier" type="file" />
<input value="Upload" type="submit" />
</form>
Philippe
Author: Philippe (philippe.grangeray@agfa.com)
Local Administrator
Hi Philippe,
thnx for the hint! Good to know that I'm not the only one digging around with this. I did some studies on this an found the following:
Uniface painting:
-8<-------------
<x-entity name="DUMMY.DUMMY">
<x-subst name="DATEI.DUMMY.DUMMY" type="file">
<input value="" name="DATEI.DUMMY.DUMMY" type="file">
</x-subst>
</x-entity>
-8<-------------
the marked lines are the important in the painting, DUMMY.DUMMY is just included to get it compiled ;)
My HTML looks like:
-8<-------------
<h1>File-Upload</h1>
<form action="!THISUSP!.upload" method="post" enctype="multipart/form-data">
<input type="file" name="DATEI">
<br />
<button type="submit">Senden</button>
</form>
-8<-------------
Uniface operation:
;###################################################################
operation upload
;###################################################################
variables
;### Parameter ###
string lv_bin_file
endvariables
;### UPLOADS handled here (Field "DATEI" has to be painted to let it happen!) ###
DATEI = $item("DATEI",$webinfo("input"))
fileload/web "DATEI", lv_bin_file
$webinfo("output") = $concat("OK! loaded ",$length(lv_bin_file)," Bytes")
end
-8<-------------
In my testset this only works aslong the stuff is painted in UNIFACE aswell ! Leaving the code in the Uniface painting away lets you -300 the code! Can you confirm this? I tried this with the TECH-GUYS in Amsterdam.
Somehow it seems that FILELOAD/WEB needs the painting to know what to do! Further more the names have to be similiar ... :/
I'm waiting for the reply from the TECH GUYS so i can finish my part 04 ("HOW TO RIA with USP - handling Inputs in the right way").
cheers,
-GHAN-
Author: -GHAN- (hansen@ahp-gmbh.de)
Local Administrator
you are right,
the field "fichier" is drawn in the component in my sample.
Author: Philippe (philippe.grangeray@agfa.com)
Local Administrator
Hi Ghan,
Please have a look at the Uniface servlet settings "Maxuploadsize" and "maxfileuploads". By default you can upload a file with size 64kb. If your file is bigger and the setting 'maxuploadsize" is not properly set, then the file gets corrupted.
Regards,
Arno
Author: Arno Bonke (arno.bonke@uniface.com)
Local Administrator
Dear Arno,
the filesize in this case won't matter ...
... the problem is that I need to "paint" a INPUT FILE in order to get it running instead of taking the data directly from $webinfo("INPUT").
any solutions on that?!
cheers,
-GHAN-
Author: -GHAN- (hansen@ahp-gmbh.de)
Local Administrator
Note: for large files, uploading can be a bit memory intensive therefore, you may want to do these operations via a dedicated UST with a low maxreq/maxidle.
Author: Jason Huggins (jason.huggins@uniface.com)
Local Administrator
Thx Jas,
I'll try to keep that in mind.
Cheers,
-GHAN-
Author: -GHAN- (hansen@ahp-gmbh.de)