How do I remove the default options from an HTML file input? - hta

I'm making an HTML file input. This is what I have now:
<input type=file accept=".ctw" name=f>
The .ctw file is a custom extension I created for a game map file. I need to make the file input accept only the .ctw file, but for some reason the file input accepts HTML pages and images. How should I remove the extra options?

Related

How to make input type should only accept PDF files?

How to make input type accpet only PDF, i have tried accept="application/pdf" in my html but it still accepts pptx, xlsx, doc, etc.
The accept attribute is only supported on some browsers, not all. I would write some jquery to check the file extension once the user has uploaded their file. If the extension is different than what you specify, then clear the field and throw an alert.
I do not have an example handy for you but it is not difficult to achieve.
check this SO question for ways to check the extension.
try this:
<input type='file' accept='.pdf' />
several extensions:
<input type='file' accept='.pdf,.doc,.ppt' />

Sitecore 8 Custom Icons without using zip file

Adding custom icons in Sitecore requires the following step:
Zip it is all. The name of archive should be the same as the containing folder (MyIcons.zip);
Upload the zip file by the path which was mentioned above: \sitecore\shell\Themes\Standard.
The problem is when I need more icons I need to add the icon and zip the file again. Is there a way to avoid this or make this maintainable without using zip file?
You can directly specify the URL of the icon you wish to use in the Icon field of the item. This can be an image on disk:
Or it can be an image from the Media Library:
I would recommend using the format such as: /-/media/F8C69CCD422C40AC843D2E4144F16964.ashx?thn=1
This ensures that the icon used is of thumbnail size (the thn=1 parameter) and by using the guid of the media item it means that the icons can be moved/restructured without having to update the Icon fields.
In both these cases, you need to manually enter the path of the icon file, you cannot specify it using the icon selector dialog.

Angular2 - File download not working if the file name contains spaces

Hi have a simple link that point to a file for download:
working file link
<a href="/assets/test/myFile.pdf" download>This Works</a>
The link works but if I try to implement a download link to a file with name that contains spaces, I get a corrupted file:
not working file link
<a href="/assets/test/my File not work.pdf" download>click here to download</a>
If I check the content of the corrupted file, I can find the html content of the homepage...
How can I manage the link to download for files that contains spaces?
Thanks
Space characters aren't allowed in URL's, so you have to encode them. Have you tried to change the name of the underlying file and referencing that?

VIM: How to autocomplete in a CSS file with tag ids and class names declared in HTML file

I'm trying VIM for HTML, CSS and JavaScript editting. I've installed a number of plugins and configured VIM so that it allows me to autocoplete standart HTML/CSS code. And now I want to autocomplete my CSS code with tag ids and class names placed in HTML files just like in Apatana. For example:
I have 1.html file with the following lines:
<div id="my_id"> </div>
<div class="my_class"> </div>
And I have 1.css file with:
#my_id{border-style:dotted}
.my_class{border-style:solid}
When I'm edditing a CSS file and pressing <c-x><c-o> right after #, I want VIM to suggest me tag ids from the 1.html file. The same for tag class names. What should I do?
What I found helpful was adding the following line to my .vimrc:
autocmd FileType css,scss setlocal iskeyword+=-,?,!
which helps me autocompleting ids and classes with various special characters.
<C-x><C-o> is for language-specific keywords such as <table> in an HTML file or background-color in a CSS file, the right shortcuts for word completion are <C-n> and <C-p>.
Supposing your HTML and CSS files are loaded in two buffers (the HTML can be hidden or visible in a split), you are supposed to type a couple of characters of the id or class name and hit <C-n> for a list of possible completions.
Type :help ins-completion for more info.
I use AutoComplPop which provides realtime completion but there are other options.

Asp display txt from access

i got a field that contains txt files in my access database.
i want to display this txt file on my page. how can i read the file and display it exactly as it in file written? In which asp component can i display it? I know some methods to read file but they don't work as i want. my text files have a format and i want to display them so in my page.
Thanks
Solved!
it was very easy. i am giving the path to the file and just calling Response.Write(pathToFile)
in template.

Resources