In my widget, I want to display attachment image on to customer portal page. I have created a custom object called 'Events'.All events must have images. So I stored images as attachments. Now we want to display attachment image as thumbnail So I need URL of attachment. I don't how to get URL of attachment.
File attachments aren't exposed to the web server, so you cannot simply reference a path to serve the image based on your object id. You could implement an API call from the controller/widget that queries for the file attachment and then inserts the image into the DOM. This could be done server-side with CPHP; use the FileAttachment sub-object on your custom object to collect the base64 encoded data of the image and then output it in the DOM. Alternatively, you could call the REST API through JavaScript and update the DOM during/after page load to get the image.
Related
I have a website built with Laravel and I need that the customer fills a editable PDF and send it to an specific address.
Instead of asking them to download it, fill it in local and then send it, I have created a new page in my site where I placed the editable PDF using an iframe.
Now, I would like to add a button that once the customer fills the PDF, it sends it automatically.
Does anybody know how to achieved this or is it not possible?
I am trying to do it using ajax, calling a method in my controller that will send the email using a template and with an attachment, but I don't know how to pass the PDF filled to it from the view(iframe).
Thank you in advance
Below image depicts a screen in my sample application which has
file upload functionality.
Below are the steps I followed to upload and save files in Database.
In this screen once user clicks "Browse" button and selects the file(s) that need to uploaded, an AJAX request will be made to server(MVC application) for each file selected.
For each upload AJAX request, server will save the file data(byte array) in session array variable and sends JSON response(which has file name and file size) to Browser.
Browser will display JSON response.
Once user clicks the "Submit" button , the file information which is already there in session variable will be stored in Database.
Following above approach I could implement the desired upload functionality.
Question: I would like to know whether this approach is correct, am I making
any mistake?
I'm working on an iOS and Android that app sends an email that contains 2 images. It doesn't attach the images to the email, rather it links to them via URL using the src property of the img tag in the email's HTML content. I would like to know if I can use Parse to store those images and reference the URLs for the ParseFiles in the email.
My questions are:
Do you just add the image to the database in a new class, or is there a separate location for public assets? (If not I can get the URL by clicking on the file which opens in a new tab in the browser.)
Is that URL guaranteed to never change so long as the image never changes? (If not I'd need to use a query to fetch the images from parse then get its url.)
Does visiting that URL for example in a web browser count as a request Parse keeps track for pricing purposes?
Piece of the email that will render the image:
<img width="186px" border="0" style="display: block; width: 186px;" src=\"http://url_to_photo_needs_to_go_here.png" alt=\"logo\">
You sure can. Every PFFile object includes a url property that you can use to directly access the file.
Simply grab this url property and insert it into the html for your email.
For reference: PFFile Class Reference for iOS (available for other SDK flavors too)
I have a problem with images in my web app. let say I have a form where there are some text fields, dropdowns, upload ajax control for multiple image upload and button Save.
I know how to upload images and posting a form and saving everything to database but the problem is that I want to achieve the following user experience:
User can upload multiple images and browser after successful upload shows thumbnail (this I know how to do it)...the problem here is that I do not want to save images to db before button save is pressed. Is there any convinient how to save temporary images...I have tried temp table which after button is pressed, copies all images to image table but here is browser refresh problem that looses all the data and images stay in a temp table. Can you use a session for storing temporary images or any other way (I think session is not particulary good idea for such things.)
One easy way to achieve that is to use the HTML5 File API and display a thumbnail once the user selects a file to upload. You don't even need to waste bandwidth as everything happens on the client. Once the user submits the form, then the image will be uploaded to the server.
Another possibility is to use one of the gazillions of available AJAX upload controls such as Uploadify, Valums Ajax Upload, Uploadify, the jQuery form plugin, ... which will allow you to upload the file to the server using an AJAX request so that you can resize it there and return the resized image to the client that you could display the thumbnail on the client.
I have a html/javascript table/grid that I need to import data from a file, this is not possible without serverside. So I decides to have a FileEcho server that takes a file upload from the table/grid, the problem is I don't want to refresh the page afterwards, it's a multipart request, not an ajax request. Is it possible to up the file ajax style?
how can this be done? any solution to my problem?
A popular way is to do the file upload in an iframe (you can set the <form>'s target attribute to the name attribute of your iframe)
You can attach an onload event on the iframe to find out when the data has been echoed from the server. From there, you can grab the contentDocument attribute from the iframe object in javascript (from there you could look at the innerHTML content of the contentDocument.body to see the data).
Just note that in IE, you have to use document.frames['frame_name'].document instead of iframeObject.contentDocument
See these articles for more info:
http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html
http://www.openjs.com/articles/ajax/ajax_file_upload/