I'm trying to create an HTML file to be uploaded to a different server from a Rails app. I need a solution similar to a mailer in Rails. Does anyone know of a feasible way to achieve this?
If you are trying to send a file between servers, the easiest way is to create an API endpoint on the other server that allows uploading a file and use an API key to secure the connection. You could very easily use an HTTP POST method to perform the transfer (https://rubygems.org/gems/httmultiparty). If you need to generate the file first:
data = render_to_string("post/show")
HTTParty.post('http://other.host/posts', contents: data)
Related
I need to upload a file repeatedly by browser (automatic) and refresh time ask me for confirm.
How can i to POST form with a specified file?
Sorry my english
It would be nice if you make available what you already tried, then we know where you are getting stuck.
Basically if you need to upload a file to a remote server you will need a dynamic language like PHP, Python, etc.
You can't send files to a remote server using plain HTML.
For security reasons HTML itself won't let you send files to a remote webserver via <form> automatically.
For that feature you would have to have your webserver handle the form via a special file like for example <form action="exampleFormHandler.php" method="post">.
Placed at your webserver, this form-handling file would have to provide the sending of that very file then.
1) I have already made transformation mapping for getting data from specific MySQL (Table Input) and convert it as Text File output.
2) Also I have created a facebook developer account page and trying to figure out how the Facebook API works to push data from MYsql to facebook.
3) would appreciate if transformation mapping can be provided. Also I would not like to use XML, instead I would like to use JSON.
Already the msql table is converted to csv file, but I am not sure how to post the csv file to facebook or is there a way to connect mysql table to facebook directly. Please share your ideas or transformation mapping. Thanks
I would Assuemm you are familiar with Facebook Development API to do all actions like post,get and so on.
You have a step called "REST CLIENT STEP" in Pentaho.
you will have an API url to post the data that you want from mySQL. There several methods GET PUT POST DELETE
Also set the Application Format to Json (XML,JSON etc).
I used to read data from FB using REST Client by using GET Method. Work around.
I am new to Node.js ,with the help of this
tutorial I've learned how to write REST API using Node.js .Can anybody please help me to understand how to upload an image file using Node.js and saving it in mysql table ? I've been searching for it , but couldn't get something useful . Any help would be useful to me.
Typically files are uploaded as multipart form data from a web page. You could start there with a simple <input type="file"> on a web page.
Create an endpoint in Express, and consider a package to help parse it. One like express-formidable would be a good start. Then you will have the file from the request.
To save to mysql, I'd suggest the package knexjs. This is a nice library to programmatically write SQL queries. You'll have to define your own tables that store the image (probably as BLOBs) and you can use Knex to store the new images into your DB.
Be aware of the asynchronous flow in NodeJS. For your Express endpoints, you only want to finish the response after the DB code is done, like inside the knex call's callback (or at the final .then() of a promise chain)
I'm really wondering what's the correct and best-practice way for importing data from a json file in an ionic 2 project so I can show it in a template, for example.
Some solutions I can find use interfaces, some don't. Some implement own small services, some don't. Some use http.get().map().subscribe(), some just use subscribe(). I would really like to know how to do this properly and would be glad if somebody could enlighten me.
From my view the best practice is to use a service and use http get request to get json file from your server. We did the same for getting language json file.
If you want securely get json file then you should put your json file at secure folder rather than public folder and create an api to get json file or json object from server.
Hope it will help
I am trying to build an Employement Management App in AngularJS where a basic operation is adding an employee.
I am displaying details using a service and getting Json data from the mock json file i am using.
Similarly, can i add form data to a textfile on the harddisk.
I have seen it done in a tutorial using $resource.save.
If at all it is possible without any server side code please share the example,it would be helpful.
Thanks.
You can make use of HTML5 local browser storage, as this does not require folder access. Mode datails here http://diveintohtml5.info/storage.html
AngularJS has modules for local storage which you can use to access such storages like this https://github.com/grevory/angular-local-storage