Page 1 of 1

Open URL - Set File Name

Posted: Thu Mar 06, 2014 9:21 pm
by jon
Hi everyone,

I have a PHP script that generates a DITA file from an HTML page using the PHP transformToXml() method. Then when I want to open the resulting DITA file via its URL, oXygen will set the file name to the PHP script automatically.

Here is the URL I am using (changed for privacy): http://www.mysite.com/php/my_script.php?url=my_url
The loaded file name will automatically be my_script.php, eventhough it's an XML file (I have set its mime-type to application/xml).

I was wondering if there was any way of changing that.
Best regards,
Jonathan

Re: Open URL - Set File Name

Posted: Thu Mar 06, 2014 9:59 pm
by adrian
Hi Jonathan,

By default Oxygen ignores the mime-type, but there's an option you can enable in:
Options > Preferences, Connection settings > HTTP(S)/WebDAV
If you enable Use the 'Content-Type' header field to determine the content type, it will recognize the mime-type and open it as expected (as an XML file).
Note that the name will still be that of the script, but the content will be handled correctly.

Regards,
Adrian

Re: Open URL - Set File Name

Posted: Thu Mar 06, 2014 10:12 pm
by jon
Thanks Adrian.
I wasn't clear enough, the content is handled correctly (eventhough I hadn't enabled the option you mentioned), but it's really just the file name I wanted to change (like, even call it "untitled" or any default name).

Re: Open URL - Set File Name

Posted: Fri Mar 07, 2014 1:21 pm
by adrian
Hi,

Unfortunately there is no 'by design' way to do this from the Oxygen side. You could probably do something on the server side or maybe within the script.

However, you could trick Oxygen to believe it's a folder URL if you end the URL with '/' and then it will provide an 'untitled' name.
e.g. add at the end of the URL a dummy parameter that has the value '/'

Code: Select all

http://www.mysite.com/php/my_script.php?url=my_url&dummy=/
Regards,
Adrian