Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 17 of 17 total
Thread Access denied saving from a module
Tue, Sep 26 2017 8:35 PMPermanent Link

KimHJ

Comca Systems, Inc

I just added a Showmessage and found that the FileComboBox1Change does not get fired on the Web Server, but does on my computer.
Wed, Sep 27 2017 3:47 AMPermanent Link

Matthew Jones

The combo box doesn't actually change anything, it just prepares for the upload of the image to the server. I don't think you can count on anything working until you have uploaded it, and then made it available somehow from the server via a URL.

I found that I had to make a form that the combo box was part of, and also have a hidden edit box which contained a unique ID. Because the upload doesn't get a response back that the browser app can use, but can be told when it is complete, I do the upload, and then when it is done I ask the server for the status of the upload with the ID supplied. I can then reference it and do whatever is appropriate.

Your setting the image URL to the value in the combo box will probably not work across browsers either, let alone on other computers. The URL needs to be relative to the server.


--

Matthew Jones
Fri, Sep 29 2017 3:37 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< In the web application I have a TFileComboBox and A TImage. When the user selects an image to upload from the TFileComboBox. On the TFileComboBox I have in the OnChange event the following code:

Image1.Url := FileComboBox1.Text;

It works fine on my computer and I see the whole path in the TFileComboBox, but when I run it on the Web Server I only see the Image name in the TFileComboBox . The image will upload I'm just missing the preview. >>

Browsers will handle the path portion of a TFileComboBox differently, depending upon the browser.  For example, IE will insert a dummy path name ('C:\fakepath\') that EWB actually strips out in the TFileComboBox control in order to avoid any confusion.

Also, if you want to do a preview of an image, the image *must* already exist on the web server in some form that the web server can serve up via the image name.  If you're doing an image upload, then there's a pretty good chance that the image doesn't exist yet on the web server because it hasn't been uploaded yet.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Oct 3 2017 8:19 PMPermanent Link

KimHJ

Comca Systems, Inc

Tim Young [Elevate Software] wrote:

<<Also, if you want to do a preview of an image, the image *must* already exist on the web server in some form that the web server can serve up via the image name.  If you're doing an image upload, then there's a pretty good chance that the image doesn't exist yet on the web server because it hasn't been uploaded yet.>>

Tim
I want to show the images before it is uploaded, since I select it from my computer the TImage.URL works fine in debug on my computer. But not when the webpage is load from a web browser. I was hopping that there was a way to get the path from the TFileComboBox.

Kim
Wed, Oct 4 2017 12:13 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< I want to show the images before it is uploaded, since I select it from my computer the TImage.URL works fine in debug on my computer. But not when the webpage is load from a web browser. I was hopping that there was a way to get the path from the TFileComboBox. >>

You can't really do what you're wanting to do, at least not until we kill off IE9 support.  In order to show a preview of an image, the image must first be uploaded to the web server so that the web server can then serve it up as a preview.  Trying to access image files locally via the browser is going to be problematic, especially considering how the security model works in most browsers with regard to local file access.

I'll see if I can push forward with moving our support up to IE10 and add the FileReader support in the browser.  That will allow you to read local files securely without issue.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Oct 27 2017 6:16 PMPermanent Link

KimHJ

Comca Systems, Inc

Tim Young [Elevate Software] wrote:

>>You can't really do what you're wanting to do, at least not until we kill off IE9 support.  In order to show a preview of an image, the image must first be uploaded to the web server so that the web server can then serve it up as a preview.  Trying to access image files locally via the browser is going to be problematic, especially considering how the security model works in most browsers with regard to local file access.<<

Tim I found this on the StackOverflow of course I have no idea how to get this working with EWB. This is how to get the local URL of the selected image so it can be previewed before upload..

function readURL(input) {

 if (input.files && input.files[0]) {
   var reader = new FileReader();

   reader.onload = function(e) {
     $('#blah').attr('src', e.target.result);
   }

   reader.readAsDataURL(input.files[0]);
 }
}

$("#imgInp").change(function() {
 readURL(this);
});

Kim
Mon, Oct 30 2017 3:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kim,

<< Tim I found this on the StackOverflow of course I have no idea how to get this working with EWB. This is how to get the local URL of the selected image so it can be previewed before upload.. >>

Yes, that relies on the support that I was referring to in my last reply, and it isn't present in EWB yet in the WebDOM unit (nor in the general component library).

Tim Young
Elevate Software
www.elevatesoft.com
Previous PagePage 2 of 2
Jump to Page:  1 2
Image