Not able to attach and post pdf files from "MyFiles" in iOS - ios

I want to attach pdf files to my application, this pdf file is stored in "Pages" application of iOS, when I try to attach this file, I am easily able to access the pdf file URL, but when I try to send the pdf to server it gives me the following error :
The file “12312331.pdf” couldn’t be opened because you don’t have permission to view it.
I used UIDocumentBrowserViewController with the desired delegate methods to get the local files,
I have already set the required keys in "Info.plist".

Related

Replace file does not work in Helhum upload example

I use the Helhum upload example to upload pdf files. The first upload works fine. But when I try to edit the record and replace the previously uploaded file, I get the following error: "The identity property "xxx.pdf" is no UID. I am using TYPO3 9.
How can I fix it?

What is the header Content type suppose to do?

So i have this ASP.Net app and i want to allow the client to have the option to download an xlsx file, im using the HttpContext.Response to set the Content Type "application/xlsx" and the Content-Disposition sets the file name with the extension .xlsx, the download works correctly.
if I change the file name to .pdf then the file is downloaded as a pdf, when I checked the developer tool network response the Content Type was "application/xlsx" and in another test I change the name fileto .png and the file was downloaded as an image (it did not work, but it was shown as an image)
So what is the content type supposed to do, does it bring some sort of security how do i make sure that the user can only downloads the file associated to the content type?
Im using response.BinaryWrite()
A content type indicates what type of content is being transmitted over http regardless of the content name. For example as you already have tested, you can transmit a pdf file naming it as a .png file.
It is the browser or the operating system that is representing a file with the name .png as an image to you. Another software would treat a pdf file with .png name as a pdf file.
The name of the file matters after the download is complete. But the software that is handling the download (in this case a web browser) actually may need to know the original media type. And you might want to write client side codes that would need to know what type of file is being transferred from the server regardless of the file name.

Web view UWP not loading files in the machine

can I open a html file on the C drive or on any location using the web view in UWP?
I am using the following code but it is not working:
Uri targeturi = new Uri("C:/Users/user/Pictures/Files/Forms/dac36cac-5d83-4fae-bf4f-112361b719ea/index.html");
browser.Navigate(targeturi);
In uwp files have limited access permission. By the default the app can only access the application install directory and data locations. Additional locations require special capabilities. More details about file access permission please reference this document.
You can gain access to files and folders on a removable device by calling the file picker (using FileOpenPicker and FolderPicker) and letting the user pick files and folders for your app to access. Learn how to use the file picker in Open files and folders with a picker.
According to your code snippet, you want to access the HTML file inside the picture folder. For accessing file in picture folder please reference Files and folders in the Music, Pictures, and Videos libraries. Pay attention on the Capabilities page, select the libraries that your app manages. So the correct way to open the file and show it in the WebView may as follows:
StorageFolder storageFolder = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.PicturesLibrary);
StorageFile indexFile = await storageFolder.GetFileAsync("index.html");/*Change to your file path inside the picture folder*/
browser.NavigateToString(await FileIO.ReadTextAsync(indexFile));
You may find I used the NavigateToString method. The Navigate(Uri) method can not navigate to a file by path directly. To load uncompressed and unencrypted content from your app’s LocalFolder or TemporaryFolder data stores, use the Navigate method with a Uri that uses the `ms-appdata scheme, to HTML content in the app package using the ms-appx-web scheme. For example:
webView1.Navigate("ms-appx-web:///help/about.html");
More details please reference "Navigating to content" of WebView. And the scenario 5 of the official sample provide samples about navigating to file you can reference.

URLSession - Download remote directory

I am currently using code based on this turtorial http://sweettutos.com/2015/11/06/networking-in-swift-how-to-download-a-file-with-nsurlsession/ to download a remote file using URLSession.downloadTask. This was suprisingly simple. However I would now like to download the entire contents of a remote directory.
Can I use URLSessionDownloadTask or is this only for single files? If not then how can I obtain a list of the files contained in the remote directory so that I can use downloadTask on each of them individually?
First of all you are thinking it in wrong way.
From the remote server, only a file that can be downloaded(not the folder) and save inside the app. The file extension that you have to download should be configure from a server side. Then the client side which you can use Sweettutos tutorial.
First thing you have to do was :
Talk with the server side developer that he had to zip the remote directory in (.zip or .rar) that you can download it only.
Then, at your code download the url which the server-side given to you and save it in document directory, extract and read the file which you want to.
At the URLSession Documentation :
Download tasks retrieve data in the form of a file, and support
background downloads and uploads while the app is not running.
So, there is no way you can download remote directory (unknown file extension) until you make that remote file available to some file extensions from the server-side.

Using Passsource.com to create Passbook Pages Unable to Change icons

I am using Passsource.com to create Passbook pages. I download the pkpass file and then I change the extension to zip. Once, the zip is created I unzip file and see the contents. I can see the icon, icon#2x, logo and logo#2x files. I replace those files with my own logo files.
Then I change the extension back to pkpass. Once, I do that I am not able to open the file in my iPhone. Any ideas on how to change the icons etc using Passsource
The manifest.json file in the pass contains a SHA-1 hash of every file in the Pass. When you modify the images, you are invalidating that hash – and the OS relies on it. You need to generate a new hash and include it in the manifest file.

Resources