How to upload file in apollo-server using graphql file extension? - upload

I am using apollo-server 2.0 and .graphql files for my typeDefs.
I am unable to create upload feature because of using .graphql extension.
I tried to use scalar Upload but it is already defined by Apollo. So it does not work neither with that definition nor without it. After my research i found that i should use gql`` keyword to define Upload type. But my types are in .graphql files so i am unable to merge them.
What can i do ?
[
[

Related

Uploading an image from iOS to Azure File Share

I have found documentation for uploading an image from iOS to a blob container in Azure - https://learn.microsoft.com/en-us/azure/storage/blobs/storage-ios-how-to-use-blob-storage
using the https://github.com/Azure/azure-storage-ios library
But I wish to upload directly to a file share. Is there a way to do this?
It needs to be implemented using SAS authentication.
Unfortunately I am not familiar with iOS programming thus I will not be able to provide you any code. However you can use the steps below to write code.
Assuming you have a SAS URL for the file share in which you wish to upload the file, you can simply use Azure Storage REST API to upload the file in a file share. You should be able to use built-in HTTP functionality in the programming language of your choice to do that.
Let's assume that you have a SAS URL for the file share in the following format: https://<account-name>.file.core.windows.net/<share-name>?<sas-token>.
First thing you would need to do is insert the file name that you wish to upload in this SAS URL so that you get a SAS URL for the file. Your SAS URL would look something like: https://<account-name>.file.core.windows.net/<share-name>/<file-name>?<sas-token>.
Next you would need to create an empty file. You will use Create File REST API operation. Do not worry about the Authorization request header there as it is already included in the SAS. Only request header you would need to include is x-ms-content-length value of which should be the size of the file you want to upload. This will create an empty file having size as that of the file you want to upload.
Once this operation completes, next you would need to upload the data in the empty file you just created. You will use Put Range operation. The request headers you need to include are x-ms-range (value of which should be bytes=0-file-length - 1) and Content-Length (value of which should be the length of your file). The request body will contain the file contents.
Using these steps you should be able to upload a file in a file share.

How can I add OS X “tags” to files programmatically, using dropbox api?

I use SwiftyDropbox to upload files, I can add own metadata to file using properties api, but can I add values to com.apple.metadata:kMDItemOMUserTags? Thanks!
No, unfortunately, the Dropbox API, which SwiftyDropbox uses, doesn't offer the ability to read or write macOS "tags" (which are stored as "extended attributes" also known as "xattrs").
The metadata exposed by default on the Dropbox API is only the Dropbox file metadata, and the file properties are only for custom defined Dropbox templates.
I'll pass this along as a feature request, but I can't promise if or when that might be implemented.

How to restrict UIDocumentPickerViewController import to .archive files? (NSKeyedArchiver)

In an app that saves data as an archive (NSKeyedArchiver), I am allowing users to export the .archive file to have a backup. Users can then re-import those files to retrieve backed up data.
Is there a way to restrict UIDocumentPickerViewController to only allow import of those .archive files? I tried using kUTTypeArchive as the only allowed type, but it doesn't appear to be the same kind of "archive", so I've used "public.item" while I look for a solution.
Running the mdls command on the file gives this file type: dyn.ah62d4rv4ge80c6xdrby1q3k
PS: If exporting and importing .archive files sounds like bad practice, I'm very interested to hear why!
The ".archive" file extension you use is not standard, it's an arbitrary file extension that you chose.
So your app should define its own custom file extension and UTI to represent your archive files. The fact that the file is created from using NSKeyedArchiver is irrelevant to the user.
Define your custom UTI and file extension under the Exported UTIs section. Then add it to the Document Types section as well.
Then use your custom UTI with UIDocumentPickerViewController so only files from your app with your app's custom extension are selectable.

Upload file to the specified path (OneDrive)?

I prefer iOS code but the solutions in other languages may refer to this question too.
I use LiveSDK to access to OneDrive. Here is a link to the example which uses upload action (onClickUploadButton:)
But I can't understand how to specify the custom upload path - only default "me/skydrive" works. How do you solve the problem when you need to upload a concrete file to a concrete path which may not exist? Should I create all the folders separately and/or get their IDs to place a file exactly into them?

Upload file type verification with Rails and Javascript

I'm currently working on a project where users can upload datasets in CSV format.
Is there a good way with Ruby other than checking file extension to determine if they're really uploading a CSV and not some executable or some other file type?
You can't do this in javascript that's for sure. If you're in a UNIX environment, you can check the documentation about this.
I don't think there is any SURE way of checking this. Usually checking the file extension is fine. Plus you said you're getting CSVs, couldn't you try to parse them? If it fails, then either the document is not at the right format or it's not a csv.
Anyways, make sure that you're storing your files in a directory that has no execute access right.

Resources