Jump to content

TUniFileUpload questions


Recommended Posts

Is there a way to avoid the dialog box with TUniFileUpload.

Exemple can i write this "http://locahost:8077?filetoupload=c:\myimage.jpg and my server start the upload automatically ?


For security reasons, browsers do only allow the user to select files manually for upload.


In the same way, can i upload multi files with TUniFileUpload with wildward or not in once ?


For new browsers you can use HTML5 in a TUniHtmlFrame. But users must select or drag&drop files.

Link to comment
Share on other sites

Hi Oliver,

I found your javascript about drag & drop (http://forums.unigui.com/index.php?/topic/1889-dd-from-os). That script brings news issues. I hope you can have a little time to lose to answer them.

1st: This script takes into account only one image. How could i use it with multi images ?

2nd: How can i save the images in an upload folder or cache folder or else ?

3rd: After the execution of the script, is there a way to send to an delphi procedure the path and/or the names of the images previously saved ?


I found numerous links about drag&drop then upload. But the upload use some php procedure that i can not use with unigui. This link (http://www.sitepoint.com/html5-file-drag-and-drop/) seems good but they use upload.php too.


best regards,


Link to comment
Share on other sites

1st: In the function "handleFiles(files)" the var "files" contains all files. I use only "var file = files[0];" for getting the first one. You must loop over all files ("for .... files").


2nd: In the function "handleReaderLoad(evt)" the var "evt.target.result" contains a string like this:


<img src="data:image/png;base64,
vr4MkhoXe0rZigAAAABJRU5ErkJggg==" alt="Roter Punkt" />


You can upload this string (as parameter) to server using function "ajaxRequest()" and then handle it on server using the "onAjaxRequest"-event of the form (or a component) on server.


In "onAjaxRequest" on server you must extract the base64-code and decode it to binary file and save it. For decoding base64 there should be functions in Delphi (maybe in IndyComponents).


3rd: The name of the file is in the var "file.name". Send it to the server in the ajaxRequest() as parameter.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...