Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Location
    Baltimore, MD
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    ColdFusion to php help

    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]

  • #2
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    Well something like this looks kinda right
    PHP Code:
    <?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
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • Users who have thanked JAY6390 for this post:

    WernerJS (02-10-2010)

  • #3
    New to the CF scene
    Join Date
    Feb 2010
    Location
    Baltimore, MD
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    coldFusion to php

    Great, I will see how it works. Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •