atlandev.mq Posted October 30, 2012 Posted October 30, 2012 Hello Farshad, 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 ? In the same way, can i upload multi files with TUniFileUpload with wildward or not in once ? best regards, Quote
Oliver Morsch Posted November 2, 2012 Posted November 2, 2012 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. Quote
atlandev.mq Posted November 4, 2012 Author Posted November 4, 2012 Thanks for your time and this answer. Bye Quote
atlandev.mq Posted November 11, 2012 Author Posted November 11, 2012 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, Th. Quote
Oliver Morsch Posted November 11, 2012 Posted November 11, 2012 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, iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0 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. Quote
atlandev.mq Posted November 12, 2012 Author Posted November 12, 2012 I said Master Morsch.... Everything work fine. I use Soap.EncdDecd (xe2) to extract the base64-code without any problem. Thanks a lot. Th. Quote
docjones Posted November 15, 2012 Posted November 15, 2012 Example, width some modifications, here Multiple Upload Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.