Save File with a custom property in Swift - ios

My app has a custom Document type and create, edit, and save the Documents with custom extension. For saving I serialize the document and write Data to a file URL. For retrieving I use FileManager methods.
I want to save a custom value with File which I don't know how to do. I want to keep the File status as editing or done. When user create a new Document it's default status should be editing and he can make the file as done manually inside the app. I don't allow to edit done files , user can only view them.
Can I use appendOnly: FileAttributeKey for this purpose, assuming to make the file read-only if user marks it as done?
I also found this answer about extend file attributes Write extend file attributes swift example.
Is this a recommended way by Apple? If above attribute cannot help I guess I'll have to use extended file attributes.. please advice
Thanks in advance

Related

I want to replace a file with existing file in database

enter image description here
Iam already uploaded a file in a database. Now i want to replace a file. So can anyone can tell me the logic to implement to do.
In my opinion you need to update the first file as disabled and add a new file as enabled.
Do you want to do this change on .net platform or you just wonder the sp logic?

How to save multiple files at once through delphi save dialog

I'm not able to save multiple files at a time in delphi save dialog box. Multiple files means I want save files without mentioning anything(or only asterisk) at "filename" field in delphi TsaveDialog. Please let me know how to achieve that.
Of course not, because that is not what it is intended for. You CANNOT obtain multiple filenames from a single save dialog. It only provides one filename at a time. That is by design.
I suspect what you really want is to prompt the user for just a folder path instead. Use the SelectDirectory() function (or the Win32 SHBrowseForFolder() function directly) for that, then you can create whatever files you need in that folder.
The save dialog doesn't save files. It allows the user to select file names. The save dialog doesn't support multiple selection so if you want to have a file dialog that allows multiple selections you need an open dialog. But an open dialog typically is used to select names of existing files, whereas a save dialog can specify a name of a file that does not yet exist.
Wildcards when entered into file dialogs are used to filter the displayed list of files. The file dialog won't return file names containing wildcards.
You imagine using wildcards, but how would you be able to do that and create new files? Wildcards are used to pattern match against existing files.
Maybe what you need is a folder selection dialog. Or perhaps you should ask the user for the name of the "master" file and then you generate the names of the "auxiliary" files using the master file name as a stem. I'm guessing because you've not told us any specifics behind your question.
My advice is to reconsider carefully what you are attempting to achieve. Think of all possible corner cases. Explore what UI idioms are used by other programs. Make sure you understand fully the capability of the file dialog controls. And then design your UI to fit with all of these constraints.

OpenERP 7: How to view/ download an uploaded file?

I have a field to upload a file to my form. Now I want to be able to view it without downloading the file (it's a photo and no editing of the file is required). When I do download the file I would like to have it keep its original name instead of being renamed to a generic name (ex. original_name.* stays original_name.* instead of becoming serial_number_22.*).
I have the following.
In my .py file:
'file_upload' : fields.binary('Sales Contract'),
In my .xml file:
<field name="file_upload"/>
With kind regards,
Please have a look at this module Document Management System. This helps you in uploading and associating files to individual records. And separately under knowledge menu you can organize, view, share files and folders and sharing via ftp is also an additional option.
I am sorry if your purpose is different. I thought this may help you.
If it's an image, you can use widget="image" to view it directly after upload.

Drupal 7 - add metadata to file on upload

I want to let users fill some metadata information i have created while uploading files.
I use file entity and media module and i have created a few fields for the image file type. For instance some of the fields are : Location, category, Title etc.
I can see and complete those fields if i navigate to "admin/content/media". But i would like users to be able to view and fill those fields when they upload their images.
I can't find anything in permissions table for that or any other setting. Can someone give some light?
thank you in advance
I managed to find something that works. Actually, i downloaded the dev versions of media module (link) and file entity module (link). The new versions enable users to edit the custom fields when they upload new files.
Hope this information helps someone else too!

Disable file preview for a custom file type in iOS

I have associated a file type with my iOS app, so I can open files of that type in the app, e.g. from an email. Opening files works, but simply tapping on an attachment in an email opens the quick view screen, which comes up blank. The file format is a zip file with a custom extension, which I believe is unique.
What can I do to disable the quick view for my file type?
I hope you came up with a solution since :)
For people who may be searching for a solution too, have a look on the protocol(s) you custom type inherits from (array key UTTypeConformsTo, name "Conforms to UTIs")
In my case, my custom type is a zip archive with a custom extension (as you) and I put "public.data" and "public.archive".
The "public.archive" was responsible for the OS to display the content of my custom zip in Files app, or having the Quick look in Mail app.
The solution was to inherit only from "public.data".

Resources