creating a file upload function with titanium - titanium

I'm supposed to develop a mobile app for moodle using android on titanium studio. And I have been searching for days for any helpful article on how to get a file chooser dialog to work on android. Most of the tutes offer image upload but I need to upload .pdf and zip files from mobile. I have already tried fileChooserDialog() and folderChooseDialog() to no avail. Help please?

There isn't a file chooser out of the box, as apps usually send files to each other internally. You can roll your own using ListViews though easily..
Build a list of all the files you're interested in. (https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem.File-method-getDirectoryListing)
Loop through the list omitting any file types you don't want and build the list
When the user selects a file capture the click event and upload that file.
Style however you want..

Related

How can I upload a whole folder of PDF files, So that I can skim through each file without having to upload each one of them individually

I have a folder of PDF files, what I want to do is build a small app with directional arrows that when pressed should upload the next PDF file from the uploaded/Selected folder.
I have tried uploading single PDF and I was able to view it, but I'm unable to find any good resource on how to upload a whole directory inside the application for me to not upload each PDF every single time.
I should be able to change my current opened PDF to the next one inside the folder.
The way to do this in Vue is as follows:
Make a input field and attach the event "v-on:input" with the function that will be called when the input is selected.
Don't forget to add "webkitdirectory mozdirectory" for firefox and chrome browsers.
Inside the function fetch the input query via "document.querySelectorAll('input');". The information of files will be inside files object.

flexdashboard and shiny pdf report

I'm new on shiny and flexdashboard.With flexdashboard I've written a .Rmd file to make a nice shiny application (I'm just a statistician).
I want to export some calculations (by a download button)in a report with a pdf file. In shiny examples, I need again to create another Rmd file, as an example of report.Rmd. I can open my application in the browser, and i'm successful to download a pdf file. But it's not working online (with shinyapps.io). I have two files with .rmd extension, and another one with .r extensions(my functions). Can it be the problem of the two.rmd?Do you Have any idea or example working?
thanks a lot in advance
It may be that the server is expecting the function files (*.R) in a certain folder and you are uploading it to another (or in the base folder).
I believe the convention is to put source files into a sub-folder called "R": /R/
If that doesn't work then try \www\. This is where icons are normally sourced from.

Xamarin Forms UWP - Display PDF

Please, help me and tell me what am I missing.
My goal is to display simple PDF file (stored locally for example) in the WebView control. Can I bind path of the file to the Source property of the WebView? Or what is the correct way to show PDF in UWP?
P.S. and if the only option is to do like here - how must I add pdf.js to my project??
My goal is to display simple PDF file (stored locally for example) in the WebView control.
If you want to display pdf in WebView control, then the methods in Display a Local PDF File in a WebView is most like the only way to solve your problem.
You can follow the steps in the xamarin official document, and here are some additional tips we need to pay attention to:
After downloading pdfjs, for UWP app, you need to copy the entire folder into the Assets folder, make sure that the folder is named "pdfjs", otherwise you will need to modify the code to change the path.
Your .pdf file should be stored into the Content folder under the Assets folder, it means you will need to create a new folder named "Content" under Assets and copy your .pdf file into this folder. Otherwise, you will also need to modify the code to change the path.
After copying your .pdf file into the "Content" folder, don't forget to change the Build Action of this file to Content like this:
Or what is the correct way to show PDF in UWP?
In uwp app, you can use Image to show PDF file, you can refer to the official PDF document sample. But I don't know if PDF can be displayed as Image in Android and IOS apps, since you're developing a cross-platform project, I think it's better to use the built-in method to solve such problem.
If a demo for xamarin UWP is needed, you can leave a comment, I will upload my demo later.

Adding a 'save to' location to Pages on iPad

I know that it is possible to use UIDocumentInteractionController to give the user a chance to open a document, say a Word document, in an application such as Pages.
Is it possible in any way to do the reverse: that is, allow a user to save the document back to an area where my application can access the newly saved document, or to provide a 'save to' option within Pages? Like how Dropbox integrates with Pages.
Thanks
Unfortunately no. Apps that support Dropbox do so by implementing the Dropbox API and syncing to the Dropbox server when online. The only way another app can give a file to your app directly is through the UIDocumentInteractionController "Open in.." feature. You can sign up for receiving files of the formats you want to support like this: those files will be written temporarily in your app bundle's Documents/Inbox and you will have to save them in another directory to be able to write to them.
This is not possible. You can't save apps to other application's space due to required app sandboxing.

Changing OS file icons using AIR app

I am building an AIR app which will be kind of like Dropbox. It will allow users to sync their files between various OSs. What I would like to know is that how can i change the default file system's file icons (add an overlay for eg) for states like - Synced and Syncing, the way Dropbox does it ??
On Windows i found out that Dropbox edits the registry files to insert the overlay icons..not yet sure how they do it in MAC OS X though.
I saw some threads here asking similar questions about AIR, but none referencing how to change file's icons. Hoping to get a solution for this from the various experts .. Please suggest any ideas if you know how it can be accomplished. Much thanks.
A simple yet effective solution would be to use icons that are only internal to your application : just embed in your application files some transparent pictures representing the various states of your files (with only the small part telling in which state it is, with the rest totally transparent), that you will add at runtime above the displayed icons.
Since you can get the actual icon of your files, just draw them into a BitmapData (if needed) & add an overlay with theses custom images, using the one related to your file's state in your application.
And one step further could be to store in your AIR application folder any resulting icons for future use (check what types of files you already have, and if your new file type isn't in thoses, export the various icons with your custom overlays to PNG files directly on the user device, for re-loading them the next time the application is opened).