Save Image To Server

Posted on 2009-05-02
Last Modified: 2012-05-06
Hi I have this script below that will show the image of whats in an email.


header("Content-Type: image/jpeg");

echo $g

how would I be able to save the image to the server?
Question by:eNarc
    LVL 5

    Author Comment

    Found it :D

    header("Content-Type: image/jpeg");

    $url = $g;//file_get_contents("");
    $fp = fopen("1.jpg", 'w');
    fwrite($fp, $url);

    and this will save the file :D awesome :D I'm totally answering my own questions here :D lol
    LVL 6

    Expert Comment

    $fp = fopen("1.jpg", 'w');
    fwrite($fp, imap_base64($g));

    Open in new window


    Accepted Solution

    Question PAQ'd, 500 points refunded, and stored in the solution database.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now