How to send image data to server? (I already have a sample page) - iphone

How to send image data to server? (I already have a sample page)
Sample Page html Source Code
<form action="/uploadfile.html" method="post"
enctype="multipart/form-data" onSubmit="return validate();">
<fieldset><legend>Upload File</legend>
<table>
<tr>
<td><input name="fileData" id="image" type="file" /></td>
</tr>
<tr>
<td><br />
</td>
<td><input type="submit" value="Upload" /></td>
</tr>
</table>
</fieldset>
</form>
It works fine on web page. (File Name: 1234.png)
This server check file name and save specific DB.
Example (These work very well on web page *http://SAMPLE_PAGE.com/uploadfile.html*)
1234.png or 5678.png =upload=> save to number.db
abcd.png or wxyz.png =upload=> save to alphabet.db
I must upload via iOS and I have a data object (imgData).
NSData *imgData; // Image Data
NSString *wantedFileName = #"1234.png";
How to upload to server via iOS Device? (like sample web-page)

When we want to upload any file on server using some application we can use multi-part request for this. In this we create a NSURLMutableRequest object with multipart body having desired data.
You can visit following links for a pointer:
send image to server in multipart iphone
Sending multipart request from iPhone to Ruby on Rails (RoR) server

Related

Contact form 7 image on email body img tag

I want to create one submission form with file/image upload. Image for company logo/picture etc. Normally I know how to attach images, as an attachment in the mail, but I want image attached on mail body as an image tag so when I open my email I can see all filed with image then print it from email.
Example email message below
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th scope="row">Your Name</th>
<td>[your-name]</td>
</tr>
<tr>
<th scope="row">Your Email</th>
<td>[your-email]</td>
</tr>
<tr>
<th scope="row">Subject</th>
<td>[your-subject]</td>
</tr>
<tr>
<th scope="row">Your Message</th>
<td>[your-message]</td>
</tr>
<tr>
<th scope="row">Picture</th>
<td><img src="[file-305]"></td>
</tr>
</tbody>
</table>
Is there any way to send image on image tag in mail body or it can be sent full from as a pdf file ?
if there have any free or paid plugins that also ok.
I would suggest you modify the email composing routine a bit and include the image as base64 as an inline image.
First conver the image to base64 using How to convert an image to base64 encoding?
$path = 'path/to/uploaded-file/myimage.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
Then include it in your email using embedding image in html email
<img src="<?= $base64 ?>" />
And most email clients should readily accept it. Otherwise you can always refer to the content id in the email of the attached file
<img src="cid:part1xxxxxxxxxx" alt="">
Yes. You can send an image through user input
I found the following resources
Check this out :
enter link description here
Download CF7 – HTML Email Template Extension
this is the format for File Upload
[file your-file filetypes:pdf|txt limit:2mb]
File Uploading and Attachment
You can try this for printing image in email body:
<img src="[url-file-305]"/>
Use this plugin to send form data with a PDF file:
Send PDF for Contact Form 7
the best and easiest way to do is just install the plugin "
Contact Form Entries". further create a contact form having file upload field and test the same.
when you upload an image and send the contact form. the uploaded image will be saved in your wordpress directory.
In my case it was uploaded in the following folder:
https://jssngo.org/wp-content/uploads/crm_perks_uploads/62da94f8afa179639552259563503/2022/07/photo.png
now use the following code in your email body:
image Tag src="https://jssngo.org/wp-content/uploads/crm_perks_uploads/62da94f8afa179639552259563503/2022/07/[file-990]"
replace the "src=" with yours and replace the [file-990] tag with yours created in contact form 7.

Outlook - Images not showing in signature of original mail when replying

I have made an email signature in Outlook (2016) by pasting HTML in the window where one can type a new signature (File>Options>Email>Signatures>New).
It looks good when sending a mail, it shows all images. The receiver of the mail (on any other mail client but Outlook, e.g. on Apple Mail or Gmail) can see the images too, but when this receiver using Apple Mail or so is going to reply to this mail, the images in the signature of the originally sent email have disappeared and have been replaced by
<image001.png> (referring to images saved locally within C:\Users\[name]\AppData\Roaming\Microsoft\Signatures, in the respective [signature name]_files folder, while the src of the original <img/>s in the signature are URLs to actual accessible files on the web). These images can be displayed anyway by clicking a button to 'include attachments of the original mail', which is, let's say, weird. It apparently turns the images in Outlook-signatures into attachments, which are being blocked or so, as it seems.
Has anyone had a comparable problem, and/or is kind to share a solution for this issue?
Thank you in advance.
Try adding ? and then a random number at the end of your image URL. Also, make sure you are using a CDN to deliver the image. I use cloudinary.com...
Here is an example of what I did...
<table cellPadding="0" cellSpacing="0">
<tbody>
<tr>
<td style="vertical-align:top"></td>
<td>
<div><font size="4">Name</font></div>
<div>Title</div>
<div><span style="margin-right:8px">phone</span></div>
<div><span style="margin-right:8px"><a style="color:blue" href="mailto:email">email</a></span></div>
<div><span style="margin-right:8px">address</span></div>
<div style="padding: 0 0em 2em 0;">
<img src="http://CDN/Facebook.jpg?7" alt="Facebook" />
<img src="http://CDN/Twitter.jpg?5" alt="Twitter" />
<img src="http://CDN/Instagram.jpg?3" alt="Instagram" />
<img src="http://CDN/Linkedin.jpg?2" alt="LinkedIn" />
</div>
</td>
</tr>
</tbody>
I open this HTML in my web browser, copy and paste it into the signature section of Outlook. One caveat.. I am using the Outlook Web Browser for my email, not the Application.
I have been testing:
Outlook -> Gmail -> Outlook, and my signature stays intact.
So far this has been working for 2 days. I am going to keep testing but give it a shot and let me know if you see the same good results.

ColdFusion submitting a form

I have a form where an user can add new people to the list. I need it to only allow the form to update if the required fields are filled out.
My current code works in Chrome or FireFox, but not with with Safari. In Chrome and FireFox, it will not submit the form unless the fields are filled out. However, Safari allows the user to submit the form even if it is left blank.
Is there any other way to write the code to make it work with all three browsers? Below is just a little of the code for some of the required fields.
<cfform method="post" action="##" name="aForm" id="addClientForm" class="">
<input type="hidden" name="method" value="clientAdd">
<input type="hidden" name="datasource" value="<cfoutput>#request.dsn#</cfoutput>">
<input type="hidden" name="Active" value="1">
<div style="float:left;" class="formContent470">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<th colspan="" style="text-align:left;">Add Client</th>
</tr>
<tr><cfoutput>
<td>
Contact
<span style="color:red">*</span>
<input type="Text" name="Contact" value="" required="Yes" message="Contact is required" maxLength="75" class="inputText430">
</td>
</tr>
<tr>
<td>
Client Name
<span style="color:red">*</span>
<input type="Text" name="ClientName" value="" required="Yes" message="Client Name is required" maxlength="75" class="inputText430">
</td>
</tr>
<tr>
<td>
Sounds to me like you're looking for server side validation. I would, of course, validate client side using Javascript and THEN back that up with server side.
Despite the well meaning advice avoid CFINPUT and CFFORM if you can (My opinion others may differ). You'll gain far greater flexibility/portability using a client side library like JQuery and sticking with plain Jane HTML form fields (steps off podium).
That being said, and assuming you'll stick with server side validation as a starting point, there's an "old school" CF method of form validation using hidden fields with specially formed name attributes. That should solve your problem. You can see this method described very well in the documentation.
-Cheers!

Internet Explorer form submit with target to iframe not working

I'm using the hidden iframe method of submitting files without loading a new page, and it works on every browser except Internet Explorer, which is strange coming from an otherwise top-notch browser.
The form and iframe look like this:
<iframe id="hidden_upload" style="display:none" src="" name="hidden_upload" ></iframe>
<form class="" action="upload.php" method="post" target="hidden_upload" enctype="multipart/form-data" id="uploadForm">
<table>
<tbody>
<tr>
<td><label for = "title">Title: </label></td>
<td><input type="text" name="title" id="title" maxlength="40" style="width:300px;"/></td>
</tr>
<tr>
<td><label for="description">Description: </label></td>
<td><textarea id="description" name="description" style="width:460px;height:135px;"></textarea></td>
</tr>
<tr>
<td><label for="file">File: </label></td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="3145728" /><input id="file" type="file" name="file"/></td>
</tr>
</tbody>
</table>
<center><input type="submit" value="Upload" id="filesubmit" onclick="return submitting()"/></center>
</form>
I have another page that DOES work in IE, with no discernible differences in the doc type, or form and iframe structure.
It's also not the headers from the upload page because I tried setting the action of the working form to the upload page of the non-working one and it still worked in IE.
The function submitting is working an returns true.
edit:
For the sake of brevity, this isn't working either:
<form class="" action="upload.php" method="post" target="hidden_upload" enctype="multipart/form-data" id="importForm">
<input type="submit" />
</form>
<iframe id="hidden_upload" style="display:none" src="" name="hidden_upload" ></iframe>
edit: This is completely ridiculous. I copied the working page verbatim into the non-working page and it still didn't work. The ONLY difference was the directory, and the .htaccess files were identical.
I had this problem and after many attempts, it was solved only as explained here:
"http://terminalapp.net/submitting-a-form-with-target-set-to-a-script-generated-iframe-on-ie/"
basically, iframe needs to be created this way:
iframe = document.createElement('<iframe name="fileUploaderEmptyHole">');
I also found out frame names for current window are stored in window.frames. In IE11, the property .name is empty for all iframes in windows.frames :O
I manually fixed like:
for(i=0;i<window.frames.length;i++)
window.frames[i].name = window.frames[i].frameElement.name;
Then, you can get to frames using target name.

form get method not working in opera browser

Why forms submited using get method is not working in opera browser?
<form method="get" action="">
I am submiting to same page
<form method="get" action="">
<table class="search_form_table" width="428" cellpadding="0" cellspacing="0" border="0" >
<tr>
<td width="150">Order Number</td>
<td><input name="order_number" /></td>
</tr>
<tr>
<td>Start Date</td>
<td><input class="search_date_fields" name="date_from" /> End date : <input class="search_date_fields" name="date_to" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input class="subimit_button search_button_width" type="submit" value="Submit" /></td>
</tr>
</table>
</form>
If this is the same problem I thought I had, it's not that GET doesn't work. It's because the browser hides the form name/value pairs in the query string in the Location bar. If you actually go to the location bar and hilite the URL that you submitted to, you'll see the form parameters in the query string. I hate this, but it is the way Opera does it. :-/
submitting GET forms certainly works in Opera. Copying this code to a file and submitting it creates exactly the same URL as in Chrome. Hence, your problem must be something else. Without more information it's impossible to tell what your problem really is.