Jump to content

Oliver Morsch

uniGUI Subscriber
  • Posts

    356
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Oliver Morsch

  1. Oliver Morsch

    Save image

    Could this produce a memory leak? I Think so, if i read this note from embarcadero: TPicture seems to use assign to make a copy (and not take ownership) of the created JpegImage-Object so that this is never be freed?!
  2. Oliver Morsch

    Save image

    What filetype (.bmp, .jpg, .png, ...) do you upload and do you really want to save it as Bitmap? You should delete "BS.Free;". What if you use field type ftBlob instead of ftGraphic?
  3. Oliver Morsch

    Save image

    Do you use the TUniFileUpload component? Then you can use the OnCompleted event of this component, see here: http://forums.unigui.com/index.php?/topic/1107-load-picture-into-database/page__p__3528__hl__fileupload__fromsearch__1&do=findComment&comment=3528
  4. <script type="text/javascript"> function success(position) { alert(position.coords.latitude + ' / ' + position.coords.longitude); } function error(msg) { alert('failed'); } if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(success, error); } else { alert('not supported'); }; </script>
  5. That is using HTML5 and works with UniGui too (in Firefox, Chrome and maybe other). With this Code you can drag'n'drop files from Windows Explorer to the Upload-division in your website. The (picture-)file will be displayed below; everything on Clientside: Link Adding this code allows you to upload the files to server: Link But my question to Farshad: Is there a size limit for params in ajaxRequest?
  6. (Uni)FileUpload uses something like: <form method="post" enctype="multipart/form-data"> <input name="Datei" type="file"> </form> And modern browsers don't let you change anything (like the "value" attribute) of <input type="file">. The browser lets the user choose a file and only just this will be uploaded for security reasons. Since the Files you got are already been base64-encoded, you could easy use something like: ajaxRequest(MyForm.MyComponent, 'SendFile', ['FileContent='+evt.target.result]); //(where evt.target.result is the base64-encoded-file you got, see other thread) in Delphi you need then something like: procedure TMyForm.MyComponentAjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); begin if EventName='SendFile' then begin //Params.Values['FileContent']; contains the base64-encoded data //it should be no problem to decode it here in delphi on server //... end; end;
  7. Is there a size limit for params in ajaxRequest? If not, you could use ajaxRequest to send the (already) base64-encoded data to the server. Then, on Server, you must decode the data to a binary file.
  8. Oliver Morsch

    D&D from OS?

    simply put this code in an UniHtmlFrame: <script type="text/javascript"> function dragEnter(evt) { evt.stopPropagation(); evt.preventDefault(); } function dragExit(evt) { evt.stopPropagation(); evt.preventDefault(); } function dragOver(evt) { evt.stopPropagation(); evt.preventDefault(); } function drop(evt) { evt.stopPropagation(); evt.preventDefault(); var files = evt.dataTransfer.files; var count = files.length; // Only call the handler if 1 or more files was dropped. if (count > 0) handleFiles(files); } function handleFiles(files) { var file = files[0]; document.getElementById("droplabel").innerHTML = "Processing " + file.name; var reader = new FileReader(); // init the reader event handlers reader.onload = handleReaderLoad; // begin the read operation reader.readAsDataURL(file); } function handleReaderLoad(evt) { var img = document.getElementById("preview"); img.src = evt.target.result; } function initEventHandlers() { var dropbox = document.getElementById("dropbox") dropbox.addEventListener("dragenter", dragEnter, false); dropbox.addEventListener("dragexit", dragExit, false); dropbox.addEventListener("dragover", dragOver, false); dropbox.addEventListener("drop", drop, false); } </script> <div id="dropbox" style="background-color: #00AAFF; height: 40px"> <span id="droplabel">Drop file here...</span> </div> <br/> <img id="preview" src="" alt="[ preview will display here ]" /> <script type="text/javascript"> initEventHandlers(); </script>
  9. I have an UrlFrame with the id "myUrlFrame" and a "div" on it with the name "myTile3". To get the text of this element, I use the following code: document.getElementById('myUrlFrame').contentWindow.document.getElementById('myTile3').firstChild.data; But the server and port must be exactly the same; Browsers deny access for security reasons, if you use another servername or port.
  10. Are the dll's located in the app-path? Then standalone server finds the dll's in its path, but in case of isapi the searchpath is the path of the internetserver (iis, apache).
×
×
  • Create New...