How to make a form able to upload files in elm [duplicate] - forms

This question already has answers here:
File Upload in Elm
(4 answers)
Closed 6 years ago.
I am trying to make a form in elm that would be able to upload a picture and some accompanying data.
Right now all my fields are updating my model via the onInput function, and I when I press the submit button I send my data as JSON via the Http.post function. If I understand well this is the idiomatic way of doing forms in elm.
Is there a way to add file uploading capabilities to this kind of form? If possible I would like to keep control in the elm app without resorting to the standard html elements to do submitting.

Here you are. Some of my notes:
http://simonh1000.github.io/2016/12/elm-s3-uploads/
https://github.com/simonh1000/file-reader
https://github.com/danyx23/elm-dropzone
https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop
File Upload in Elm
elm: read file content
https://www.paramander.com/blog/using-ports-to-deal-with-files-in-elm-0-17
Add support for https://github.com/elm-lang/html/issues/20
https://github.com/lovasoa/elm-fileinput
https://www.reddit.com/r/elm/comments/4926am/uploading_files_through_elmhttp/
http://elm-ui.info/documentation/guides/handling-files
How to trigger click event in elm

Yes, native code is needed for two things:
to access the FileReader API; and
to 'trick' the HTTP library into allowing you to add a file to a multipart form.
This is all covered in this blog post, which accompanies the FileReader library mentioned by rofol.
Instead of native code, you can of course use ports.

Related

is it possible to view a question with a browser before importing it to Moodle?

I have created a XML file using R-exams out of just a single exercise to be imported to Moodle. I would like to view it before uploading it in the Moodle question bank. I tried to open it with Firefox and I can see some code but not the output and a message appear saying that the XML file does not seem to have a style sheet associated to it. Is there a way to find this style sheet and to see how the question comes out just using a browser like Firefox or Chrome?
To emulate how the R/exams exercises are converted to HTML by exams2moodle() and how Moodle displays mathematical content, it's best to use
exams2html(..., converter = "pandoc-mathjax")
In recent versions of R/exams the resulting HTML file then automatically loads the MathJax Javascript that enables correct rendering of mathematical content in all modern browsers (including Google Chrome). See also http://www.R-exams.org/tutorials/math/ for some general advice about math in HTML.
To the best of my knowledge there is no tool that would quickly display Moodle XML files in such a way that you can easily assess them.

Working with PDF's in Objective C [duplicate]

This question already has answers here:
Insert a PDF file into Core Data?
(2 answers)
Closed 9 years ago.
I am currently building an iOS app that will be manipulating PDF documents. You will be able to type in information about yourself and the app will populate certain text fields on a document with the correct information and create a PDF that you will be able to save, share, etc.
I'm rather new to iOS programming. What are some things I should know?
Can I use Core Data with PDF's?
Can I populate a stock PDF with the info or do I have to use some other format and create a PDF from the final product.
You could use Core Data to store your information, but that would be separate to any PDF consideration that your app had. It may be best for your app to store the information and provide a view which shows the PDF layout, but not actually as PDF, and then allow the view to be exported as a PDF.
This answer shows how to save the view as a PDF.

Is it possible to upload a file as a blob of data using filepicker.io, instead of using the file selection modal?

I have this problem:
I want to make an interface where the user can drag and drop file uploads. Filepicker.io provides an easy solution to this in the form of filepicker.makeDropPane. However, this feature does not support parallel uploads without the callbacks getting confused.
So I would like to write my own drag/drop interface using standard html5 listeners, and make a direct api upload call to filepicker.io with the actual file data in string form. This way I can write the management of parallel uploads on my own.
Does filepicker.io have an api call that would allow me to do this? I only see these two things:
1) File selection modal
2) Auto drag-drop features
I don't see a way to simply upload a file directly from file data.
What can I do?
You should make use of the filepicker.store() command, which accepts a DOM file object. For example:
var input = document.getElementById("store-input");
filepicker.store(input, function(FPFile){/*your code here*/});
More details available at https://developers.filepicker.io/docs/web/#store

Uploading an image in Zend Framework

I am new in Zend Framework and learning it. I want to upload image into my database and display that image in view page. I search lots of tutorial but no step by step guidance. Want a help. Thanks in advance.
You need to take a look on Zend_Form_Element_File in Zend documentation:
The File form element provides a mechanism for supplying file upload
fields to your form. It utilizes Zend_File_Transfer internally to
provide this functionality, and the FormFile view helper as also the
File decorator to display the form element. By default, it uses the
Http transfer adapter, which introspects the $_FILES array and allows
you to attach validators and filters. Validators and filters attached
to the form element are in turn attached to the transfer adapter.
Database side, you need to use a BLOB type to hold your image (I assume you're using MySQL).
However, note that best practices are to store the image path in the database instead of the image itself.
At last, there are tons of tutorials out there that explains precisely how to do what you're looking for, you just need to look for "file upload using zend element file" and you will find them!

iPhone : Problem while sending image and text in HTML formate using MFMailCompose [duplicate]

This question already has answers here:
How to add a UIImage in MailComposer Sheet of MFMailComposeViewController
(8 answers)
Closed 2 years ago.
I am sending HTML in mail using MFMailCompose.
This HTML includes strings and images.
So when I use to send this mail, It is sending text only. It does not display any images.
How can I send my all HTML data So that images are shown in email ?
To my knowledge you cannot embed images into the HTML body of a message (though you can, of course, embed references to images located elsewhere on the net). Images attached to the HTML message (using the mail composer's function for adding attachments) will generally (with most mail readers) be displayed following the message in a fairly "attractive" format. (Note that you don't get this nice formatting if the message itself is not HTML.)
I am working on doing the same thing, i.e. trying to embed an image into an email message. I just came across the following post http://davidjhinson.wordpress.com/2009/01/21/embedding-images-in-outbound-email-using-cocoa-touch/ that looks promising. I have not tried this yet but will do so later this week. If you try this yourself, let us know if it worked for you.