Apex 4.2 capture filepath using file browse item - oracle-apex

Apex 4.2 : I want to capture the filepath after browsing and selecting a file using item File browse (WWV_FLOW_FILES). The file is uploaded as a BLOB but all info regarding its original location is missing, as it is replaced by f.i. F12457/<name doc>.docx. When using File Browse (browsing for a document and selecting) however the complete path (f.i. L:\abc\def\document.docx) is shown in the field (although its value then is already F999999/document.docx).

Browser security stops JavaScript from accessing this information
How to get full path of selected file on change of <input type=‘file’> using javascript, jquery-ajax?
eg:
$('#P6_FILE').val()
"C:\fakepath\12c_notes.txt"

declare
v_doc varchar2(100);
begin
select :P_DOCUMENT into v_doc from dual;
:P59_DOCNAME := v_doc;
end;

Related

Oracle APEX - hyperlink shown as text on a static region

I have a static region and I want to set it to some text with a hyperlink. Text comes from the database - returned by a function.
So I added a page item (P1_LINK_TEXT) to the page and added a computation to my page item that is set to PL/SQL expression:
MyFunction('MY_TEXT')
The region Header Text to &P1_LINK_TEXT.
It works great, except the hyperlink displayed as is - Click here
instead of displaying the link. I made sure that Attributes->Settings->Output As is set to HTML but still, the hyperlink is not displayed correctly. What am I doing wrong?
Use the escape filter to ensure html characters are not escaped. To display the item as html use this notation:
&P1_LINK_TEXT!RAW.

How to download file from local directory using python

I want to download a file from the local directory when the user clicks on a particular link. How I can do it using python.
Try this on click of link:
location.replace('your_loacal_filepath')
For Example:
location.replace('/files/out.txt')
if you are rendering HTML, then you should read about the HTML download Attribute
Quoting
The download attribute specifies that the target will be downloaded when a user clicks on the hyperlink.
This attribute is only used if the href attribute is set.
else if(currentobj.filename != null){
var xy = '{% static "/documents/dataset/" %}' + currentobj.filename;
alert(xy);
var $tr = $('<tr><td style="padding:5px;"><a href="'+ xy +'"
target="_blank" download>' + currentobj.filename.slice(0,25) +
"....." +'</a></td> </tr>');
$tbl.append($tr);
}
just add download tag along the hyperlink
if you want to specify a specific name for the download file then just mention it like this
<a href="/images/myw3schoolsimage.jpg" download="w3logo">
You can try this.
The download attribute instructs browsers to download a URL instead of navigating to it.
Check out. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes

Sitecore: How to get a Hyperlink Manager Url from a General Link Field

In the sitecore Rich Text Editor, user can highlight some words and insert a hyperlink. User can select a media item and it will generate a url like ~/media/9A3E8962D4364D0A9F98178A9572CC08.ashx
I have a general link field, what code should I write to generate the above Url? I have tried GetMediaUrl and GetItemUrl method, but they both return the file location.
My goal is that I need to get a url from a field which look like ~/media/9A3E8962D4364D0A9F98178A9572CC08.ashx. Should I use a different type of field? The file which the link is pointing to is a pdf.
You should pass custom MediaUrlOptions to get desired URL format:
var mo = new MediaUrlOptions();
mo.UseItemPath = false;
var url = Sitecore.Resources.Media.MediaManager.GetMediaUrl(imageField.MediaItem, mo);
UseItemPath indicates whether item path or item id should be used for URL.

Imacros, web page to save to specific folder?

I have this macro for firefox, for web page saving (htm):
VERSION BUILD=7500718 RECORDER=FX
'
'Ask for a name
!VAR1 NoName_Time_{{!NOW:yyyymmdd_hhnnss}}
'
'Save the page
SAVEAS TYPE=CPL C:\Pages FILE={{!VAR1}}
It works OK, htm page is saved and images and css file are saved in created subfolder.
What I want to change is for jpg images and css files to be saved in specified folder such as ’C:\Images’ so that htm page can find them in that folder.
I tried:
SAVEAS TYPE=CPL FOLDER=C:\Pages FILE={{!NOW:yyyymmdd_hhnnss}} TYPE=CPL FOLDER=C:\Images
But I got error:
wrong format of SAVEAS command, line 5 (Error code: 910)
Any solution?
SAVEAS TYPE=CPL FOLDER=C:\Pages FILE={{!VAR1}}

Sitecore: How do I retrieve the Mimetype / extension of a File field in XLST

I want to know either the mimetype or the extensions of a file field so that I can place an appropriate icon next to the download link.
I've been able to do this fine in .NET code. Should I just convert this rendering to a sublayout?
Adding a 3rd parameter to the sc:fld call lets you select a parameter from inside that field, you can then split the value on the '.' and go from there..
<xsl:variable name ="filename" select="sc:fld('file',.,'src')" />
Extension is : <xsl:value-of select="sc:SplitValue($filename,'.')[2]"/>
Hope this helps :D