I'm using a dropzone with the option
acceptedFiles: "video/*"
In Safari, when I click it, I can't select .m4v-files (works in FireFox) in the Explorer-window. However, it works via drag & drop.
From the example above its looks like you missed a quota ("), if not, try to change the accepted files value to files extension, its should fix this:
acceptedFiles: ".mp4,.mkv,.avi"
From DropZone:
The default implementation of accept checks the file's mime type or
extension against this list. This is a comma separated list of mime
types or file extensions. Eg.: image/*,application/pdf,.psd. If the
Dropzone is clickable this option will be used as accept parameter on
the hidden file input as well.
See more: http://www.dropzonejs.com/#config-acceptedFiles
Related
I'm currently creating html template designs in Laravel which are outputted as PDF documents and would like to use the font-awesome icons within the PDF documents.
I have tried the following syntax:
$fontname = TCPDF_FONTS::addTTFfont('fontawesome-webfont.ttf', 'TrueTypeUnicode', '', 96);
$bod = '<span style="font-family:FontAwesome;font-size: 2em;"></span>';
PDF::writeHTML(nl2br($bod), true, false, true, false);
However when viewing the PDF document regardless of which hex code is used to display the icon its just displays a question mark. How can this issue be resolved?
Instead of inline styles, try setting the font with setFont() before displaying $bod:
PDF::setFont('FontAwesome','',20);
PDF::writeHTML(nl2br($bod), true, false, true, false);
Possible, you will need to open the font definition file, generated by your addTTFFont and check it for the proper font name to use with setFont() (in my example, i assumed it to be FontAwesome).
Also, pay attention to the difference between addTTFFont and addFont methods. You only need to call addTTFFont once — it will create needed files from your TTF. After that, you can add them with addFont method, using proper name (see the generated font definition file for it).
I'd like to restrict the number of files listed in the file list area of the Fine Uploader Open dialog by using the wild card name (see image). Is there a simple way to do this? Thanks!
Here is the picture of the Open dialog that contains a wild card name
Use the validation.acceptFiles option. For example, the following will limit the selection to video files:
new qq.FineUploaderBasic({
validation: {
acceptFiles: 'video/*'
}
})
This feature is only a light wrapper around the file input element's "accept" attribute, which has spotty browser support.
I have an application that can load in third party code. One of the capabilities that the third party code can do is add formats in which the app can export to. I am using saveDocumentTo: as means for implementing export.
I understand that I can customize the menu of available filetypes to save in via overriding writableTypesForSaveOperation: for my document, but what doesn't work is that in the save dialog an appropriate file extension isn't added to the filename when selected from the menu.
I tried overriding fileNameExtensionForType:saveOperation: but that doesn't even get called.
How can I make the Save dialog find the correct file extension (provided it isn't known at compile time)?
I've done this within a custom export accessory view for the Save Panel. The custom export accessory view just changes the NSSavePanel's allowed file types whenever the user changes the format they want to export to.
If you want to set the extension, pass an array with one element containing that extension.
The docs have some important detail for -[NSSavePanel setAllowedFileTypes:]'s behavior in this regard, for supporting more complex cases:
Discussion
A file type can be a common file extension, or a UTI. A nil value indicates that any file type can be used. The default value is nil.
If no extension is given by the user, the first item in the allowedFileTypes will be used as the extension for the save panel. If the user specifies a type not in the array, and allowsOtherFileTypes is YES, they will be presented with another dialog when prompted to save.
NSOpenPanel: In versions of Mac OS X less than v10.6, this property is ignored. For applications that link against v10.6 and higher, this property determines which files should be enabled in the open panel. Using the deprecated methods to show the open panel (the ones that take a types: parameter) will overwrite this value, and should not be used. The allowed file types can be changed while the panel is running (for example, from an accessory view). The file type can be a common file extension, or a UTI. This is also known as the “enabled file types.” A nil value indicates that all files should be enabled.
You may also see dedicated export dialogs in some cases which can reduce the complexity of this if you have several distinct formats. As before, you just update the allowed file types to support this (not necessarily dynamically in this case).
I want to save to a file, all the data returned from multiple AJAX requests. The requests are of the same format. And AJAX is using JSON (which encodes text in UTF-8).
I'm trying out "Fiddler Web Debugger" and I've added a filter to show only the AJAX sessions and in the Inspectors-bottom window I can see the returned text that I'm interested in. To view this text in this bottom window I can either select the 'JSON' button or the 'Text' button and then press the "Response is encoded and may need to be decoded" button.
I then tried Menu > File > Save > Save all sessions. This looks like it might be saving what I need but I cant really tell as most of the text is gobbldy gook (just the headers are intelligible).
Is this the best way to save data returned from multiple requests?
Is there some way to translate the gobbledy gook? (I'm guessing the problem has something to do with the UTF-8 encoding).
Ideally the file would show a list of JSON string - one for each returned text. Though, if not, I can parse it to extract the data I need.
Thanks.
UTF-8 encoding is effectively the same as ASCII for most western languages. It sounds more likely that the server is GZIP-compressing the response content which is why it would be binary gibberish instead of plaintext. You can direct Fiddler to automatically decompress and unchunk all responses using the AutoDecode button on the toolbar.
Fiddler offers many different export formats, depending on what your end goal is. You can save in a "lossless" Session Archive Zip (SAZ) format if you plan to reload the content into Fiddler. Or, you can use the options shown by the File > Export command to export in many other formats. Or, you can write a bit of script (Rules > Customize Rules) to export the content in any way you'd like.
I have CFileDialog and set filter for it (Text files *.txt). When it opens, I see only TXT files, thats right. But! when I'm typing text into filename, the hint (under filename field) is showing all files (files with any extension).
Can be this behavior changed by some flag? I want force hint to show only TXT files.
...
CFileDialog f(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_NOCHANGEDIR,_T("Text files (*.txt)|*.txt|All files (*.*)|*.*||"));
if( f.DoModal() != IDOK ) return;
...
My experience with this is that the file filter will control what is shown in the list of files, but when you type the auto-complete is matching against everything in the current directory. I can't think of a good way to prove that it can't be done, but I haven't seen anything in the MFC docs or code that would let you do that.
You can subclass the CFileDialog and override the CFileDialog::OnFileNameOK() function to reject the entry of any file name that doesn't match your criteria. you might also be able to get the functionality you want by overriding CFileDialog::OnFileNameChange() to reject a user supplied file name before they click the Open (or Save) button, but I have not done that myself to know exactly how it would work out.