Uniface on GitHub
Fixes and Updates
Author: email@example.com (bioalexy)
Hi, I need help in creating a DSP capable to manage de upload and download of files (images mainly) on the Web Browser Any suggestions?
Hi, take a look in this thread uniface-9-6-04-web-dropzone-integration
Also what if i only want to use just an input with the type="file"? Is it possible?
Hello, yes, you can do this : http://unifaceinfo.com/forum/uniface9/fileuploadviawebbrowser/ But it is not obvious, in the uniface documentation, that the name of the input file tag, must have a matching uniface field with the same name drawn in the component. Philippe.
Hi Philippe, So i need to use an USP then? Can't be done in a DSP?
It can be done with a DSP too. The layout doesn't need to be bound with the component structure. The unique constraint, is that you need a component field with the same name of the "html input file tag". for instance a DSP named mydsp :
You need at last an entity DUMMY with a field FILENAME
<form target="_self" action="mydsp" enctype="multipart/form-data" method="post" name="form">
<input name="filename" type="file" />
<input value="Upload" type="submit" />
lvFileName = $item("FILENAME", $webinfo("INPUT'))
if (lvFileName != "")
; something has been submited
fileload/web "FILENAME", lvContent ; load stream from submit
filedump/raw lvContent, lvFilename ; dump file on server
; draw the DSP
Hi Phillipe, Seems to be working thanks for the help!!!
Hi again, I'm having a little problem with My Upload DSP because is inside a DSP Container, so when the form is submitted the file is uploaded but also the page is redirected, how can i prevent that?
You can, of course, customise this tag, with sizes, borders, etc...
I've now uploaded the sample "DSP File Upload" here: http://unifaceinfo.com/community-samples/
Ah yes, that's a good point, thanks. I'll add that requirement to the readme in the sample. If it's not supported in earlier browsers then you'd want to go the iframe route as you've suggested. You can actually programatically create an iframe and make quite a tidy solution that way. There are actually a lot of widgets out there which will do the browser detection for you and then pick the appropriate strategy for doing the upload. The Uniface back-end would be the same whatever.
Thanks James, I'll have a look at the sample
© 2021 Uniface Privacy & Cookies | Privacy Statement | Legal