...

View Full Version : ColdFusion to php help



WernerJS
02-09-2010, 10:03 PM
Can anybody translate this into php? I haven't the first clue how to approach this.

[CODE]
<cfset x = GetHttpRequestData()>
<cfset startBase64 = findNoCase('base64', x.content) />
<cfset base64content = mid(x.content,startBase64+7, len(x.content)) />

<cfset UseFileName = GetDirectoryFromPath(GetCurrentTemplatePath()) & "shots\pastedImage" & DateFormat(Now(), "mmddyyyy") & TimeFormat(Now(), "hhmmss") & ".jpg" />
<cffile action="write" file="#UseFileName#" output="#ToBinary(base64content)#" />
<cfset session.UseFileName = UseFileName>

<cfoutput>#URLEncodedFormat(trim(UseFileName))#</cfoutput>
[CODE]

JAY6390
02-10-2010, 02:36 AM
Well something like this looks kinda right

<?php
session_start(); // Start the session
$base64content = $_POST['base64']; // This may be $_GET instead of $_POST
$dir = '/path/to/shots/folder/'; // Set folder for image to be written to
$_SESSION['UseFileName'] = $dir.date('his').'.jpg'; // Assign full file path to session
file_put_contents($_SESSION['UseFileName'], $base64content); // Write content to file
echo urlencode($_SESSION['UseFileName']; // Echo file path

WernerJS
02-10-2010, 01:12 PM
Great, I will see how it works. Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum