Results 1 to 8 of 8
  1. #1
    ABW Ambassador MoneyBusiness's Avatar
    Join Date
    March 14th, 2006
    Posts
    2,051
    Red face PHP Know-how needed please
    Ok, you PHP gurus. I've just about finished up a script to download images for one of my datafeed sites. At first, I had scripted it to download the images into a database blob field - then realized how much of a pain it is to integrate it into product listings (with more than one image at a time).

    So, I've decided to have it download to my local server, with ID as the name. All's fine and well there, but I'm having a problem specifying where to actually save the file (using 'fwrite()')

    Whenever I try to save it in a path like such: \\directory\\imagename.jpg , it actually saves it to the local disk with that name: "directory\\imagesname.jpg", instead of putting INTO the directory.

    Any ideas of what I'm doing wrong here? The lines of code are:


    Code:
    $varFileTo = "\\popular-images\\" . $varMyID . $varFileType;
    
    $newfile = fopen($varFileTo,'wb');
    
    fwrite($newfile, $image, strlen( $image ) );
    Any help would be appreciated. I've searched a good bit, but this seems to be how to do it...so I'm left scratching my head.

  2. #2
    Pimp Duck popdawg's Avatar
    Join Date
    January 18th, 2005
    Location
    Take off eh?
    Posts
    3,249
    I put the full path in mine
    $full_file_path = "C:/apache2triad/htdocs/SITE/FOLDER/IMAGEFULDER/".$file_filename;

    oops .... just reread the question
    gimme a minute
    ================================================================
    Been away, now I'm back. Not as much, but I'm back & starting from scratch. Where I was, was fantastic. Where I am now, less so. Things have changed, become harder. So have I. Game ON!!!
    ================================================================

  3. #3
    ABW Ambassador MoneyBusiness's Avatar
    Join Date
    March 14th, 2006
    Posts
    2,051
    I didn't think to try that. Was trying to use the directory relative to the script. Let me give that a shot (in about an hour or so) and I'll let you know how it turned out.

    Thanks Pops!

  4. #4
    Pimp Duck popdawg's Avatar
    Join Date
    January 18th, 2005
    Location
    Take off eh?
    Posts
    3,249
    if it doesn't work, let me know.
    Ill pm you my code.
    ================================================================
    Been away, now I'm back. Not as much, but I'm back & starting from scratch. Where I was, was fantastic. Where I am now, less so. Things have changed, become harder. So have I. Game ON!!!
    ================================================================

  5. #5
    ABW Ambassador MoneyBusiness's Avatar
    Join Date
    March 14th, 2006
    Posts
    2,051
    Will do - thanks again!

  6. #6
    Pimp Duck popdawg's Avatar
    Join Date
    January 18th, 2005
    Location
    Take off eh?
    Posts
    3,249
    no worries
    This bugged the hell out of me when I was trying to get it going.
    ================================================================
    Been away, now I'm back. Not as much, but I'm back & starting from scratch. Where I was, was fantastic. Where I am now, less so. Things have changed, become harder. So have I. Game ON!!!
    ================================================================

  7. #7
    ABW Ambassador MoneyBusiness's Avatar
    Join Date
    March 14th, 2006
    Posts
    2,051
    Well, I ended up being able to use the relative paths, but I wouldn't have figured it out until I noticed your path (used forward slashes, not backslashes). As soon as I changed the slashes, it worked like a charm.

    Was stuck on that all last night, and part of today. And it always turns out to be the simplest of fixes - staring me right in the face!

    Thanks again!

  8. #8
    Pimp Duck popdawg's Avatar
    Join Date
    January 18th, 2005
    Location
    Take off eh?
    Posts
    3,249
    ================================================================
    Been away, now I'm back. Not as much, but I'm back & starting from scratch. Where I was, was fantastic. Where I am now, less so. Things have changed, become harder. So have I. Game ON!!!
    ================================================================

  9. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. PHP/MySQL programmer needed
    By Verdant in forum Member Services
    Replies: 5
    Last Post: March 8th, 2014, 07:58 AM
  2. PHP question - include(file.php) with variables
    By teezone in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: September 4th, 2009, 04:54 PM
  3. Custom Database(MyPhpAdmin) and PHP Needed
    By CustomersFirst in forum Couponer's Corner
    Replies: 0
    Last Post: March 15th, 2008, 03:41 PM
  4. quick PHP help needed.
    By Steveinid in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: December 13th, 2003, 02:22 AM

Posting Permissions

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