I have an app in which the user should be able to get a txt file from there external storage in order to upload to firebase_storage. The thing is, I don't know the path of the file, so I want the user to be able to choose this like they would be able to choose a pdf using file_picker or pick an image using image_picker? How would I be able to do this?
I figured out that I can use the flutter_document_picker and specify in that that I want a txt file for the device to get.
Related
I've got an 'interactive PDF' that I need to be able to edit and save in an iOS app and I'm looking at how to achieve it. It's got text boxes and radio buttons which I can interact with in the UIDocumentInteractionController preview (or QLPreviewController) but there doesn't seem to be a way to save those changes to the file that was loaded and if I share the live and edited file to my mac via AirDrop it doesn't send the changes, rather it seems just the original file.
I don't really know anything about interactive PDFs so not sure how added text would normally be saved. I've found that the 'Files' app (added in iOS 11) actually saves the edits you make, so that's basically what I want to be able to do.
At the end of the day I just need a way to be able to interact with a PDF in my app and save the changes. Do I maybe need to use a custom PDF viewer rather than trying to piggy back off the standard iOS file previewer functionality?
Looks like this library solves my problem: https://github.com/derekblair/ILPDFKit
It lets you edit a PDF, access and set individual fields and save out as a static PDF.
I am trying to assign a text file to a dropbox link so that I can read and write to it from anywhere instead of using a local text file. I have tried the following code, but it doesn't seem to work.
assignfile(txtfile, 'http:/dropbox.com/s/0872ng3r7rg0pwq/share.txt?raw=1');
rewrite(txtfile);
writeln(txtfile, 'text');
closefile(txt)
How can I do this?
You cannot easily work with a remote file like this. Unless Dropbox supports a protocol like Samba, which would enable you to mount it as a virtual drive, you need to do some more work with the file.
The course of action here would be:
Download the contents of the file.
Edit it however you want.
Upload it back to the server. To do that, you need to use Dropbox API. See https://www.dropbox.com/developers/documentation/http/documentation#files-upload for example (I am not sure if this particular method is what you need, I am guessing).
In my app I want users to be able to associate a file(s) they have on their desktop/DropBox with a specific item, but I don't want/need them to be able to actually attach the file...I just want to get the file name and location and save that in my database. Then when I display the item I'll hyperlink to the location captured. Can someone point me to an example(s) of how to accomplish this? I looked at the JQuery File Upload (http://blueimp.github.com/jQuery-File-Upload/) but as I mentioned don't actually need to upload the file...so this should be something super easy.
Thanks for your time and assistance.
You can try and get value of file input, but you'll fail.
See this jsfiddle.
All I'm getting is the fake path
C:\fakepath\134.png
And there's certainly no C:\ drive on Mac OSX. :)
I guess, this is because of security restrictions. You shouldn't know (or care) about user's filesystem in a web app.
I'm having trouble working on FileReference download(URL) function. I needed to automatically download the files in a particular space on my harddisk but the SAVE AS dialog always displays. can I make it automatically download in a certain place on my disk?
I'm going to assume "automatically download" means "save" here. Nope, If you use FileReference (or File in AIR), there's no way to automatically save without showing the Save As dialog box.
If you don't need to access the file outside of the app, then take a look at the SharedObject class: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html. By default you can create SharedObjects of up to 100KB without needing the client's permission (see the description of getLocal()), which should be fine for more simple text or xml info - you can compress it using ByteArray if you want to save space. Any more than that and a small dialog will open asking permission. Once you've given permission however, it won't ask again.
I have a upload text file field, and with it I plan to save the file somewhere and then store the location of the file in a database. However, I want to make sure the file they uploaded is a .txt file, and not, say, an image file. I imagine this happens in the validation step. How does one validate such a thing? Also, how do you get the filename of the uploaded file? I could always just check if it said '.txt' but for future reference knowing how to validate without just the filename would be helpful.
Trying to validate the contents of a file based on the filename extension is opening the door for major hackerdom. It's trivial to change the extension and upload the file.
If you are on a Mac/Linux/Unix-based system the OS "file" command is the standard because it looks inside the file for key bytes that flag file types. http://en.wikipedia.org/wiki/File_(Unix) I'm not sure what's available for Windows, but this might help: Determine file type in Ruby
One way of doing it, the simple way really, would be to pass the file through an image loader, preferably one that handles multiple common formats, and see if it throws an error.
The other way is to manually check the file header for common image format headers. For example, .bmp files start with BM. Other formats have their own specific markings you can use.