Apex File Browse... Mime type restriction text/csv - mime-types

I want to restrict the files seen by the Apex (5.1) File Browse to only CSV files. I am scratching my head on this one as when I set the mime type attribute to mime/csv I get all files. I have tried other mime types text/*, image/* they work as intended, I only see files these types of files. When I do upload CSV files Oracle sets the mime_type field in apex_application_temp_files to text/csv so this is internally recognised. I also have the multi-file select option set.
What am I doing wrong? If this is actually is a bug is there a work around?
Thanks
Bob
Oracle 12c DB, Tomcat, Chrome

Try this:
<!-- (IE 10+, Edge, Chrome, Firefox 42+) -->
<input type="file" accept=".xls,.xlsx" />
Fill the field "Custom Attributes"
Reference: Limit file format when using <input type="file">?
If you need to restrict the upload only for one type of files, so, create a constraint in your table that check if the mimetype is of this type.

Restriction e.g. to Excel (XLSX)
Under "Setting" set "File Types" with the following content to restrict file browse to XLSX only.
accept=".xls,.xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel
#See source: https://w3c.github.io/html/sec-forms.html#element-attrdef-input-accept

Related

go swagger how to add support for all mime type

Swagger by default supports application/json as Content type. And if I want to add other Content types then "produces" or "consumes" fields needs to updated in the swagger JSON file. Client may send any type of Data. Is there a way to support any Content type (remove the validation for Content type or regex like *) in swagger
As far as I have worked on go-swagger, you will have to mention in the swagger-spec file and generate the code again in order to do that. You can use / to describe that the endpoint can generate all type of data. But you can not modify it after you have generated the code using go-swagger.
You can directly modify the generated files but it's not recommended.

Change default content type for previewing site with "nanoc view"

I generate HTML files without any filetype extension with the following route in nanoc’s Rules file:
route '/blog/*/' do
item.identifier.chop
end
So the file /content/blog/hello-world.html gets generated as /output/blog/hello-world, leading to the URL path /blog/hello-world.
When using nanoc’s built-in preview server (nanoc view, which uses adsf and WEBrick, as far as I understand), these extension-less HTML files get interpreted as plain text.
For previewing with nanoc view, how can I set the default content type (i.e. text/html) for files without filetype extensions?
(When publishing this site, I set the correct content type in Apache’s .htaccess file so that the files get interpreted as HTML, but WEBrick/adsf don’t seem to support .htaccess.)
You should be writing those to /output/blog/hello-world/index.html instead. That makes them work seamlessly in nanoc view, Apache (with no .htaccess), even by just opening the site files in your browser (assuming you're using relativized links).

Handling filetypes that contain multiple files?

Some filetypes in Visual Studio includes more then one file, for example resx and winform files. So If I need to add existing filetyp of this type I always end upp with multiple files in solution explorer? Are thay not supose to be shown as one file based on there name?
BestRegards
So If I need to add existing filetyp of this type I always end upp
with multiple files in solution explorer?
Multiple file is the part of ProjectItem template. If you add WinFor you will always get several files.
If you don't want to use such template you can create your own template from code created ones with File->Export Template wizard.
To group files in solution explorer read this post

most common file type to html converter

Is there a plugin(for example joomla plugin) or program which converts most known file type(.chm, .doc, .pdf etc..) to html. After conversion I want to search any item in that text.
PS: I know that there are some programs pdftodoc, doctohtml.. But I need a whole program or portal which converts all generic file types to html and in that portal there must be a search properties.
Thanks.

Drupal Attachments (FileField) file path

What function in Drupal gets file attachment path?
Edit: the attachments provided by Upload module in system section. But since you mentioned there may be another way around it. Maybe I could achieve may goals using FileField module so if you could tell me how to get a direct link of a file uploaded by FileField module that may also be very helpful.
Edit 2:
Ok I will start from my main and final objective:
It is to get an image linking to a file which visibility I could be managed using CCK module.
I am doing this step by step. So now I have written a code which generates the needed image and I have added that image to one of content types teaser. I found a way to warp my image in a tag and I had dug up simple attachments url. So my next step is to advance from simple upload attachment to the one added by FileFields and from odd looking HTML pace in all PHP document into beautifully managed CCK field.
How to fetch file path of a file uploaded FileFields?
Some plain and at the same time rich tutorials for making custom fields for CCK module.
Assuming you know how to get the $node object for a node containing a file attachment, this is super easy:
Upload (core)
$file = upload_load($node);
echo $file[1]->filepath;
Where 1 is the index of the file. Upload can let you upload more than one file, so file 2 would have an index of 2 and so on. If there's only one file, it'll always be 1.
More info: upload_load() API reference.
FileField
echo $node->field_fieldname[0]['filepath'];
Where field_filename is the short name you've used for the field, and 0 is the index of the field. CCK fields let you have multiple values in one field, so 0 would be the first, 1 would be the second, etc. If you only have one value, it'll always be 0.
Note: if you want to get the rendered output of the FileField using its formatters, you can just use $field_fieldname in your node template, or if you want to store the rendered output, you can use:
echo content_format('field_fieldname', $node->field_fieldname[0]);
More info: content_format() API reference.
Upload is a sad little module, and has been completely replaced with a core implementation of FileField in Drupal 7. If you have the option to use FileField, you should.
Don't direct links of file attachments appear below the uploaded file for the core Upload module?
Since you are trying to use images, you should use http://drupal.org/project/imagefield CCK module in order to add images to specified content type. After that using the Display fields tab in Content type configuration you can specify how image would be presented (as a link, image, image with link to node...) both in teaser and body view.

Resources