FineUploader - get metadata during upload and store it - metadata

I am using FineUploader and it works just fine for my application needs. The files end up where I need them etc.
However once the file is uploaded, I really don't know what the file actually is. For instance the file could be a resume, a cover letter, a release of information, etc. For that I will need to "attach" additional metadata that relates to that file.
Is there a way to add some sort of a select box, where the user will select a category (before the upload process begins) so that the file can be identified by that category? The filename, size and other information gathered during the upload process are already stored in the database.
Any pointers are more than appreciated.
Edit: Duplicate Submit multiple form fields for each file in FineUploader

Related

Programmatically add/associate metadata to any file

I'm building a tool that will export files from a learning management system and store those files somewhere like S3. I need to keep track of certain pieces of information about those files that relate to the system they're coming from (e.g. course name, academic term, student's name/id). The file types will vary drastically, so I don't want to make accommodations to store the metadata based on the filetype (like pdf or doc).
What's the best way to associate filetype-agnostic metadata to a file? I'm toying with the idea of generating a JSON file for every file I bring over, but it would be great if I could add the metadata directly to the file itself.

Import/Export data in CSV format, stored in Core data via email

I am working on an app which is extensively based on Core data. I got several entities and relationships. The format is kinda like this -
There is an entity "CARDS" which has one to many relationship with "RECIPIENTS" (another entity) and "CUSTOMERS" (another entity). The recipients and customers can be added/modified/deleted by the user. The list is stored in a table view.
I want to do an export of that data (recipient, customers etc.) via email. But all that is stored in Core data right? So Do I have to store that in documents directory somewhere or get the path to where it is stored in core data?
I followed these links but they don't use core data as such to store the data, will the logic be the same as shown in the link below: -
http://www.raywenderlich.com/1948/itunes-tutorial-for-ios-how-to-integrate-itunes-file-sharing-with-your-ios-app
http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app
Any help will be really appreciated.
Thank you
You specify the path to the .sqlite file when you create the store. You can copy that file (using NSFileManager) to another location and rename it (to change the extension to some custom value that is specific to your app). Once you have moved it, if you moved it to the correct folder it will automatically be available to iTunes sharing. Or, you can get the data for the file (using dataWithContentsOfFile:) and then add that as an attachment to an e-mail (again, specify a file extension for the attachment that is specific to your app).
You then want to look at teaching your app to handle that file extension to allow importing (see this).

How do I edit files in place that were uploaded to Moodle?

I would like a better workflow for debugging uploaded SCOs. As things are, I must edit a file in the activity, repackage, upload, and test. Often, I just need to change a single line of code. It would be VERY nice to be able to edit that file, that line of code, on the server. So far, all I've found is that Moodle manages the files, so it seems impractical to locate and decipher the renamed files after upload.
Is there a way to configure Moodle so that it doesn't rename and relocated files in SCOs upon extraction? Actually, I'm open to any suggestions on the best, fastest workflow for debugging SCOs.
Problem background
Since Moodle 2.0, files are no longer stored on server in the conventional /this/is/the/path/to/my.file way. Instead, files are rehashed and stored in Repositories (i.e. spread all over the moodledata folder as a collection of seemingly random data). This increases security and cross-OS compatibility but complicates stuff for people who would like to simply upload a SCORM zip package via FTP. Here's more information on file handling in Moodle 2.0
Path to the soluton
Let's locate the file you want to update, then update it.
Run phpmyadmin, go to mdl_files table, find your file by name in the filename field (let's say it's portrait.jpg)
Look at the contenthash field, it'll look like abcde1234567890. This means your file is stored in moodledata/filedir/ab/cd/ folder under the name abcde1234567890.
Rename the updated portrait.jpg to abcde1234567890, upload and overwrite.
Go back to phpmyadmin and update the filesize field in record for portrait.jpg with the size of the updated file.
Obviously, this process can be automated. You'll have to write a script that allows you to upload a file, then it'll search for that file in mdl_files, save it to the correct folder and update all fields accordingly.
Alternative idea
Enable external package type (and also enable 'Update on every launch'). Go to Site administration / Plugins / Activities / SCORM and check the box down below. Now you'll be able to launch SCORM packages directly from another server, so Moodle won't mess with it. Of course, you can run in other (probably cross-domain related) problems.
Sergey's answer is very good, with one caveat:
In his example with the contenthash of abcde1234567890, the file is stored in the moodledata/filedir/ab/cd/ folder under the name abcde1234567890. Moodle uses the full contenthash to name the file.

download multiple files using SimpleFTPSample

I've been trying to figure out how to download multiple files in a row based on the SimpleFTPSample provided by apple. Basically, I'm filtering what the user can see when they browse an ftp server, but when they select a certain file type, I want it to automatically check for another file of the same name with a different extension and if it exists, download it as well. I can't seem to get this second file to download no matter what I do. It seems strange because if I select two files in a row in my tableview, it downloads both of them just fine. Any ideas?
Edit:
It's just the SimpleFTPSample from apple.developer.com, all I did was create additional NSInputStream and NSOutputStream objects and I created a new _startReceiveFile method that gets called from _startReceive if I'm downloading a file instead of getting a directory listing. _startReceiveFile is the same code for _startReceive in the file download code for the sample project, except if the file to download has a certain extension, it also downloads an additional file with the additional stream objects. Let me know if I need to clarify more or try to put together a clear example.
Well, since there were no takers, I'll just post my solution here. I've abandoned trying to download two files at once. Instead, I just keep the ftp browsing window open and only handle the opening of the file once both files have been downloaded (user has clicked on each one separately). It's not what I wanted, but it will work, at least until I can figure out how to get two files with one request.

Replace existing XML file within iPhone app

I have an .xml file that is going to be shipped within my app.
This file contains values that are read from it and saved as an array when the app launches.
Each time the app is run, I want to check with the server if there is an internet connection. If so, I want to get the newest version of the .xml file from the server and replace the one that I currently have saved in my app (this way, the next time the user logs in and doesn't have internet access, he/she will be able to use the old (yet most up to date) data).
What is the best way to do this?
Thanks,
The best way to probably do this is to copy the XML file from the app bundle to a location in the app's sandbox, e.g. the Documents folder. Thereafter you can update the XML content as necessary with newer data from the server. The copy is necessary to allow you to write to the file, since you cannot change the content of your app's bundle because it is signed.
Alternatively, if the data is simple enough, you can just save it to user defaults on first launch and change the defaults on subsequent updates
I might skip the XML altogether, unless it contains a baseline of default settings, and just sync user defaults over the Internet. You can't modify files in the bundle, so your only option would be to copy over a "default-settings" XML file to the application's Documents folder to make it editable.