Upvote 2

The upload widget: can it just return the selected path?

Under Consideration vs1969-2 6 years ago

Currently the upload widget shows and returns c:\fakepath\<filename> where <filename> is the name of the selected file.

I was able to fake file uploading behavior to some degree like this:

1) put the regular input field on top of the file upload input field (leaving the browse button visible)

2) in "on change" event of the file upload control:

a) deleted the c:\fakepath\ part of the value of the file upload widget,

b) replaced it into some predefined valid path (so the files must be in the specific directory, but it is better than nothing)

c) set the value of the regular visible input field to this new path (so the user will not see this fakepath thing)

3) set e.g. the value of the image control (or whatever will show the image) into the new value of the input field i.e. the one with valid path.

So now it works like this:

a) the user sees the image and the upload widget

b) he/she clicks on browse, goes to the specific directory (known beforehand)

c) selects the file there and clicks ok

d) the image widget shows the image, the text input near the "browse" button shows the "correct" path.

My question is simple: if the widget is able to return the name of the selected file, and the image control is able to show the image from the path built via expression, why cannot let the upload widget just return the selected path together with the file name? Without this c:\fakepath ugliness?

It will allow it to work with the image widget immediately.

Replies (1)

Hi there,

Apologies for the late response. We've been looking into this and right now we're not able to implement this idea due to a security issue imposed by web browsers. We will keep investigating a way around this.



Leave a Comment
Attach a file